> On Nov 15, 2017, at 7:16 PM, Greg Parker via swift-evolution 
> <[email protected]> wrote:
> 
>> 
>> On Nov 15, 2017, at 5:53 PM, John McCall <[email protected] 
>> <mailto:[email protected]>> wrote:
>> 
>>> On Nov 15, 2017, at 7:36 PM, Greg Parker via swift-evolution 
>>> <[email protected] <mailto:[email protected]>> wrote:
<snip>

>>> 
>>> "compactMap" is okay if "compact" is added. Is "compact" a common enough 
>>> operation in practice to pull its own weight?

It might be a good criteria, given placeholder ‘xxx’ which is a verb, to think 
of whether for xxxMap or xxxedMap, if xxx/xxxed would be acceptable and 
descriptive terms. We didn’t have flattened() for flatMap, so I think whether 
xxxed()  is present or not is a separate question.

Optional is an adjective, so there may be an ‘xxx’ in the function xxxMap which 
is also an adjective. Not sure how that plays into the naming conventions.
 
>>> "mapSome" is great if you know about Optional.Some but terrible if you 
>>> don't. ("Okay, it maps some elements, but which ones?") 
>>> 
>>> "mapNonNil" is obvious and ugly and perhaps its obviousness makes it a 
>>> winner.
>> 
>> mapSome and especially mapNonNil both sound to me like they only map the 
>> non-nil values in the source sequence.
> 
> I thought it did map the non-nil values in the source sequence. Did I 
> misunderstand what the proposed filterMap does? It occurs to me that the 
> proposal does not have a standalone description of the filterMap operation.

It maps all values to optional results, discarding any results which are nil 
and returning just a collection of the unwrapped results - right?

Speaking of which, I don’t feel Sequence.unwrapped() passes muster per my 
stated criteria above.

-DW
_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to