> On 24 Jun 2016, at 16:26, Charlie Monroe via swift-evolution > <swift-evolution@swift.org> wrote: > >> >> On Jun 24, 2016, at 4:11 PM, Anton Zhilin via swift-evolution >> <swift-evolution@swift.org> wrote: >> >> Vladimir.S via swift-evolution <swift-evolution@...> writes: >> >>> Do you mean *sorted*(by:) ? Or I'm missing something in naming rules? >> >> IIRC, sort is mutating and sorted is nonmutating (copying) version. >> Also, I forgot `initial` parameter in `reduce`. >> >>>> Data flow is an area where code becomes the less understandable when >>>> more visual clutter is added. In my opinion, >>>> >>>> array.filter(isEven).map(square).reduce(sum) >>>> >>>> reads better than >>>> >>>> array.filter(suchThatTrue: isEven).map(applyingTransformation: >>>> square).reduce(accumulatingResultBy: sum) >>>> >>>> What do you think? >>> >>> +100. I even want to brought the term-of-art argument here. IMO These >>> functions are expected to be called without any parameter names. >> >> That would probably be a good scenario, but core team needs to release >> their grip on strictly following new naming conventions. > > I know it might not exactly by the naming conventions, but have you considered > > filter(predicate:) // Though it might get confused with (NS)Predicate? > map(transform:) > reduce(accumulator:) > > All of this may be extended to follow the convetions: > > filter(usingPredicate:) > map(usingTransform:) > reduce(usingAccumulator:) // or applyingAccumulator? > > But I agree the label-less argument here reads best. >
Depending on how the API Guidelines (specifically about “omit needless words”) is read and if one considers a function (A) -> Bool to be a predicate and a function (A) -> B to be a transform, then the argument could be made that the words “predicate” and “transform” should be omitted. This only leaves the label “using” in both these cases (which I find to be too general and not very descriptive). - David > >> >> _______________________________________________ >> swift-evolution mailing list >> swift-evolution@swift.org <mailto:swift-evolution@swift.org> >> https://lists.swift.org/mailman/listinfo/swift-evolution >> <https://lists.swift.org/mailman/listinfo/swift-evolution> > > _______________________________________________ > swift-evolution mailing list > swift-evolution@swift.org <mailto:swift-evolution@swift.org> > https://lists.swift.org/mailman/listinfo/swift-evolution > <https://lists.swift.org/mailman/listinfo/swift-evolution>
_______________________________________________ swift-evolution mailing list swift-evolution@swift.org https://lists.swift.org/mailman/listinfo/swift-evolution