Re: [swift-evolution] [Pitch] Add an all algorithm to Sequence

2017-04-06 Thread Ricardo Parada via swift-evolution
If we were looking for conciseness then my picks would be: every() - every elements meets condition any() - anyone element meets condition none() - none of the elements meets condition Examples: nums.every { isEven } nums.any { isEven } nums.none { isEven } nums.every(matches: { isEven }) num

Re: [swift-evolution] [Pitch] Add an all algorithm to Sequence

2017-04-06 Thread Muse M via swift-evolution
In additional, containsAll(value: "123") is prefer and more natural as we speak. On Thursday, April 6, 2017, Muse M wrote: > I accept "contains" for at least match one result, similar to OR. > "containsOnly" is similar to AND for one element or more elements must > contain same values and types

Re: [swift-evolution] [Pitch] Add an all algorithm to Sequence

2017-04-06 Thread Muse M via swift-evolution
I accept "contains" for at least match one result, similar to OR. "containsOnly" is similar to AND for one element or more elements must contain same values and types. On Thursday, April 6, 2017, Xiaodi Wu via swift-evolution < swift-evolution@swift.org> wrote: > In JavaScipt they are known as "e

Re: [swift-evolution] [Pitch] Add an all algorithm to Sequence

2017-04-06 Thread Xiaodi Wu via swift-evolution
In JavaScipt they are known as "every" and "includes". In C# they are "TrueForAll" and "Exists". Not sure why "all" and "contains" is any less consistent. On Thu, Apr 6, 2017 at 05:50 Víctor Pimentel Rodríguez via swift-evolution < swift-evolution@swift.org> wrote: > On Thu, Apr 6, 2017 at 12:44

Re: [swift-evolution] [Pitch] Add an all algorithm to Sequence

2017-04-06 Thread Víctor Pimentel Rodríguez via swift-evolution
On Thu, Apr 6, 2017 at 12:44 AM, Jonathan Hull via swift-evolution < swift-evolution@swift.org> wrote: > On that note: ‘containsOnly' is still my favorite by a wide margin. I > know it is longer than ‘all’, but it’s behavior is much clearer (especially > for those of us who have never used or hea

Re: [swift-evolution] [Pitch] Add an all algorithm to Sequence

2017-04-05 Thread Jay Abbott via swift-evolution
>From a clarity at point of use point of view areAll is the best suggestion so far. Even when other variables or methods aren’t named very well, it suggests both the plural nature of the thing being operating on, and the boolean nature of the return value, for example: yourBase.areAll { $0.belong(

Re: [swift-evolution] [Pitch] Add an all algorithm to Sequence

2017-04-05 Thread Jonathan Hull via swift-evolution
On that note: ‘containsOnly' is still my favorite by a wide margin. I know it is longer than ‘all’, but it’s behavior is much clearer (especially for those of us who have never used or heard of ‘all’ in other languages), and it’s relationship with ‘contains’ is also very clear. Thanks, Jon >

Re: [swift-evolution] [Pitch] Add an all algorithm to Sequence

2017-04-05 Thread David Waite via swift-evolution
Even with a closure, at the point of use it would likely be clear that the value is being used as a boolean condition - vs “filter” which returns an array. -DW > On Apr 5, 2017, at 4:06 PM, Jarod Long via swift-evolution > wrote: > > I don't think an argument label is sufficient to satisfy th

Re: [swift-evolution] [Pitch] Add an all algorithm to Sequence

2017-04-05 Thread Jarod Long via swift-evolution
I don't think an argument label is sufficient to satisfy the first fundamental API design guideline: "Clarity at the point of use is your most important goal." The argument label is not visible at the point of use when using trailing closure syntax, so it provides no additional clarity there. Mo

Re: [swift-evolution] [Pitch] Add an all algorithm to Sequence

2017-04-05 Thread Kevin Nattinger via swift-evolution
I definitely think we should stick with `all` and an appropriate argument label. It’s a term of art and the label makes it perfectly clear what to expect. That said, `all(match)` and `all(equal)` sound to me like they expect an object to compare each against (func all(equal needle: Element)) I su

Re: [swift-evolution] [Pitch] Add an all algorithm to Sequence

2017-04-05 Thread Brandon Trussell via swift-evolution
I retract my gripes on the original names also. The argument labels make the intent of the method clear. On Wed, Apr 5, 2017 at 11:23 AM, Thorsten Seitz via swift-evolution < swift-evolution@swift.org> wrote: > +1 > > Am 03.04.2017 um 10:29 schrieb Daniel Duan via swift-evolution < > swift-evolu

Re: [swift-evolution] [Pitch] Add an all algorithm to Sequence

2017-04-05 Thread Jarod Long via swift-evolution
On Apr 5, 2017, 13:21 -0700, Xiaodi Wu , wrote: > On Wed, Apr 5, 2017 at 2:22 PM, Jarod Long via swift-evolution > wrote: > > > `integers.all { $0.isEven }` reads like an alias of `filter` to me. The > > > meaning is ambiguous because the missing argument label can be filled in > > > in differ

Re: [swift-evolution] [Pitch] Add an all algorithm to Sequence

2017-04-05 Thread Xiaodi Wu via swift-evolution
On Wed, Apr 5, 2017 at 2:22 PM, Jarod Long via swift-evolution < swift-evolution@swift.org> wrote: > `integers.all { $0.isEven }` reads like an alias of `filter` to me. The > meaning is ambiguous because the missing argument label can be filled in in > different ways -- some will read this as "all

Re: [swift-evolution] [Pitch] Add an all algorithm to Sequence

2017-04-05 Thread Jarod Long via swift-evolution
`integers.all { $0.isEven }` reads like an alias of `filter` to me. The meaning is ambiguous because the missing argument label can be filled in in different ways -- some will read this as "all are even", and others will read it as "all that are even". I think that ambiguity should be avoided.

Re: [swift-evolution] [Pitch] Add an all algorithm to Sequence

2017-04-05 Thread Thorsten Seitz via swift-evolution
+1 > Am 03.04.2017 um 10:29 schrieb Daniel Duan via swift-evolution > : > > I want to retract my nitpickings on argument labels; `all(equal:)` and > `all(match:)` are the best names for these methods. > > things all match condition? > things all equal value? > > If we accept `all` as a term o

Re: [swift-evolution] [Pitch] Add an all algorithm to Sequence

2017-04-05 Thread Thorsten Seitz via swift-evolution
nums.allSatisfy { $0 % 2 == 0 } -Thorsten > Am 03.04.2017 um 03:06 schrieb Ricardo Parada via swift-evolution > : > > I think the problem would be that if you want to use it with a trailing > closure then it becomes misleading: > > nums.contains { $0 % 2 == 0 } > > > Sent from my iPhone >

Re: [swift-evolution] [Pitch] Add an all algorithm to Sequence

2017-04-04 Thread David Rönnqvist via swift-evolution
I agree that `all(equal:)` and `all(match:)` are really good names for these methods (I could also consider `every`). In my understanding of the Swift API Design Guidelines, it’s good for a number of reasons: It omits needless words. It’s a sequence of Element, so explicitly mentioning “eleme

Re: [swift-evolution] [Pitch] Add an all algorithm to Sequence

2017-04-03 Thread Adam Bridge via swift-evolution
Perhaps allMembersMatch() or everyMemberMatches() This reads well in use. On 2017-04-02, 6:18 PM, "Ricardo Parada via swift-evolution" wrote: or perhaps containsOnly() or maybe allMatch() or membersMatch() :-) Sent from my iPhone

Re: [swift-evolution] [Pitch] Add an all algorithm to Sequence

2017-04-03 Thread Ricardo Parada via swift-evolution
Yep, I like those too. I think it would be very clear if they were named that. > On Apr 3, 2017, at 3:57 PM, Adam Bridge wrote: > > Perhaps > > allMembersMatch() > > or > > everyMemberMatches() > > This reads well in use. > > On 2017-04-02, 6:18 PM, "Ricardo Parada via swift-evolution" >

Re: [swift-evolution] [Pitch] Add an all algorithm to Sequence

2017-04-03 Thread Ed Wellbrook via swift-evolution
Nice, would be good to see this added. Surprised this doesn’t exist already, tbh. > On 31 Mar 2017, at 16:48, Xiaodi Wu via swift-evolution > wrote: > > Agree, this is a nice addition as-is. > > > On Fri, Mar 31, 2017 at 10:42 AM, Sean Heber via swift-evolution > wrote: > I like it. > > l

Re: [swift-evolution] [Pitch] Add an all algorithm to Sequence

2017-04-03 Thread Brandon Trussell via swift-evolution
I like onlyContains() and containsOnly() so far. On Mon, Apr 3, 2017 at 1:29 AM, Daniel Duan via swift-evolution < swift-evolution@swift.org> wrote: > I want to retract my nitpickings on argument labels; `all(equal:)` and > `all(match:)` are the best names for these methods. > > things all match

Re: [swift-evolution] [Pitch] Add an all algorithm to Sequence

2017-04-03 Thread Daniel Duan via swift-evolution
I want to retract my nitpickings on argument labels; `all(equal:)` and `all(match:)` are the best names for these methods. things all match condition? things all equal value? If we accept `all` as a term of art (which I think we should), along with these labels the use site are very readable!

Re: [swift-evolution] [Pitch] Add an all algorithm to Sequence

2017-04-02 Thread Ricardo Parada via swift-evolution
or perhaps containsOnly() or maybe allMatch() or membersMatch() :-) Sent from my iPhone > On Apr 2, 2017, at 1:57 AM, Rien via swift-evolution > wrote: > > >> On 02 Apr 2017, at 07:51, Karl Wagner via swift-evolution >> wrote: >> >> Given the relationship to contains, why not keep it simp

Re: [swift-evolution] [Pitch] Add an all algorithm to Sequence

2017-04-02 Thread Jonathan Hull via swift-evolution
I guess we could do containsOnly()? > On Apr 2, 2017, at 6:06 PM, Ricardo Parada wrote: > > I think the problem would be that if you want to use it with a trailing > closure then it becomes misleading: > > nums.contains { $0 % 2 == 0 } > > > Sent from my iPhone > >> On Apr 2, 2017, at 9:01

Re: [swift-evolution] [Pitch] Add an all algorithm to Sequence

2017-04-02 Thread Ricardo Parada via swift-evolution
I think the problem would be that if you want to use it with a trailing closure then it becomes misleading: nums.contains { $0 % 2 == 0 } Sent from my iPhone > On Apr 2, 2017, at 9:01 PM, Jonathan Hull via swift-evolution > wrote: > > What about contains(only:)? > > Thanks, > Jon > >> On

Re: [swift-evolution] [Pitch] Add an all algorithm to Sequence

2017-04-02 Thread Jonathan Hull via swift-evolution
What about contains(only:)? Thanks, Jon > On Apr 2, 2017, at 6:32 AM, BJ Homer via swift-evolution > wrote: > > 'forAll' is definitely confusing; it sounds like iteration; I would not > expect that the closure would be required to return a Bool. The > implementation would likely bail out as

Re: [swift-evolution] [Pitch] Add an all algorithm to Sequence

2017-04-02 Thread Ricardo Parada via swift-evolution
I associate exception with error. Sent from my iPhone > On Apr 2, 2017, at 9:32 AM, BJ Homer via swift-evolution > wrote: > > 'forAll' is definitely confusing; it sounds like iteration; I would not > expect that the closure would be required to return a Bool. The > implementation would like

Re: [swift-evolution] [Pitch] Add an all algorithm to Sequence

2017-04-02 Thread Nevin Brackett-Rozinsky via swift-evolution
I don’t think it is worth our collective effort to bikeshed this right now. The feature might be nice, but it is a small thing that is easily done without. Since we know that naming things is one of the two hard problems in computer science , I thin

Re: [swift-evolution] [Pitch] Add an all algorithm to Sequence

2017-04-02 Thread BJ Homer via swift-evolution
'forAll' is definitely confusing; it sounds like iteration; I would not expect that the closure would be required to return a Bool. The implementation would likely bail out as soon as a single item failed the test; there is no guarantee that each item would be visited, so iteration is an incorre

Re: [swift-evolution] [Pitch] Add an all algorithm to Sequence

2017-04-02 Thread Richard Wei via swift-evolution
`withoutException` sounds confusing to me. And it’ll potentially make a Swift newcomer think it has something to do with runtime exceptions. IMO `forAll(_:)` is the best name. It looks logically, quantificationally clear. With regard to the possible confusion w/ `forEach`, the “each" in `forEac

Re: [swift-evolution] [Pitch] Add an all algorithm to Sequence

2017-04-01 Thread Xiaodi Wu via swift-evolution
Given that most popular languages seem to use the word "every" or "all" in the name of their analogous functions, I think it's very valuable to honor that legitimate user expectation if at all possible. I do believe the Swift API naming guidelines are not so rigid as to prohibit such a name. While

Re: [swift-evolution] [Pitch] Add an all algorithm to Sequence

2017-04-01 Thread Rien via swift-evolution
> On 02 Apr 2017, at 07:51, Karl Wagner via swift-evolution > wrote: > > Given the relationship to contains, why not keep it simple and go with: > > onlyContains(_ element:) > onlyContains(_ matching:) > > [9, 9, 9, 9, 9].onlyContains(9) // true > [1, 2, 3, 2, 3].onlyContains { $0 < 3 } // fa

Re: [swift-evolution] [Pitch] Add an all algorithm to Sequence

2017-04-01 Thread Karl Wagner via swift-evolution
Given the relationship to contains, why not keep it simple and go with: onlyContains(_ element:) onlyContains(_ matching:) [9, 9, 9, 9, 9].onlyContains(9) // true [1, 2, 3, 2, 3].onlyContains { $0 < 3 } // false - Karl > On 1 Apr 2017, at 10:47, Xiaodi Wu via swift-evolution > wrote: > > On

[swift-evolution] [Pitch] Add an all algorithm to Sequence

2017-04-01 Thread Robert Bennett via swift-evolution
It figures, the hardest thing to pick is the name of this function… I like forAll the best so far, but I worry that it sounds too much like forEach and would be confusing. What does everyone think of withoutException? nums.withoutException(isEven) and nums.withoutException { isEven($0) } make t

Re: [swift-evolution] [Pitch] Add an all algorithm to Sequence

2017-04-01 Thread Ricardo Parada via swift-evolution
Hi all, I think that when used without the argument label it is not as clear what it does. For example: nums.all { $0 % 2 == 0 } can be interpreted as give me all the even elements. So if the argument label were to be left out, then I would rename it. Some options: nums.allSatisfy { $0 % 2

Re: [swift-evolution] [Pitch] Add an all algorithm to Sequence

2017-04-01 Thread André Videla via swift-evolution
I agree that if “contains” has its place in the standard library, so does “all” I also regularly use the extension func forAll(suchThat predicate: (Element) -> Bool) -> Bool which I use like so [0,1,2,3,4].forAll(suchThat: isEven) [0,1,2,3,4].forAll { $0 < 5} > On 1 Apr 2017, at 19:58, Nevin

Re: [swift-evolution] [Pitch] Add an all algorithm to Sequence

2017-04-01 Thread Nevin Brackett-Rozinsky via swift-evolution
If indeed “all(equal:)” is rarely needed, then perhaps it is best to leave it out *and also* leave out the argument label from “all(matching:)”. Then the signature would be similar to, func all(_ predicate: (Element)->Bool) -> Bool and the points-of-use would look like: nums.all( isEven ) nums.a

Re: [swift-evolution] [Pitch] Add an all algorithm to Sequence

2017-04-01 Thread Letanyan Arumugam via swift-evolution
> On Sat, Apr 1, 2017 at 3:40 AM, David Hart via > swift-evolutionmailto:swift-evolution@swift.org)>wrote: > > > > On 1 Apr 2017, at 09:50, Brandon > > Trussellmailto:brandon...@gmail.com)>wrote: > > > > > I agree that based on the method name, I thought a collection would be > > > returned. >

Re: [swift-evolution] [Pitch] Add an all algorithm to Sequence

2017-04-01 Thread Rien via swift-evolution
> On 01 Apr 2017, at 18:09, Muse M wrote: > > At this stage, it's rather confuse to me, if return boolean, probably sizeOf > and boolOf is easier for me. > > boolOf(equalTo:) > boolOf(matching:) > Or: allEqual(to: ) allMatch(_:) or allItemsEqual(to: ) allItemsMatch(_:) Rien. > On Sat, A

Re: [swift-evolution] [Pitch] Add an all algorithm to Sequence

2017-04-01 Thread Muse M via swift-evolution
At this stage, it's rather confuse to me, if return boolean, probably sizeOf and boolOf is easier for me. boolOf(equalTo:) boolOf(matching:) On Sat, Apr 1, 2017 at 10:54 PM, Rien via swift-evolution < swift-evolution@swift.org> wrote: > > > On 01 Apr 2017, at 16:10, David Hart wrote: > > > >> >

Re: [swift-evolution] [Pitch] Add an all algorithm to Sequence

2017-04-01 Thread Rien via swift-evolution
> On 01 Apr 2017, at 16:10, David Hart wrote: > >> >> On 1 Apr 2017, at 11:32, Rien wrote: >> >> >>> On 01 Apr 2017, at 10:47, Xiaodi Wu via swift-evolution >>> wrote: >>> >>> On Sat, Apr 1, 2017 at 3:40 AM, David Hart via swift-evolution >>> wrote: >>> On 1 Apr 2017, at 09:50, Br

Re: [swift-evolution] [Pitch] Add an all algorithm to Sequence

2017-04-01 Thread David Hart via swift-evolution
> On 1 Apr 2017, at 11:32, Rien wrote: > > >> On 01 Apr 2017, at 10:47, Xiaodi Wu via swift-evolution >> wrote: >> >> On Sat, Apr 1, 2017 at 3:40 AM, David Hart via swift-evolution >> wrote: >> >>> On 1 Apr 2017, at 09:50, Brandon Trussell wrote: >>> >>> I agree that based on the method

Re: [swift-evolution] [Pitch] Add an all algorithm to Sequence

2017-04-01 Thread Rien via swift-evolution
> On 01 Apr 2017, at 10:47, Xiaodi Wu via swift-evolution > wrote: > > On Sat, Apr 1, 2017 at 3:40 AM, David Hart via swift-evolution > wrote: > > On 1 Apr 2017, at 09:50, Brandon Trussell wrote: > >> I agree that based on the method name, I thought a collection would be >> returned. >

Re: [swift-evolution] [Pitch] Add an all algorithm to Sequence

2017-04-01 Thread Georgios Moschovitis via swift-evolution
> ``` > areAll(equalTo:) > areAll(matching:) > ``` +1, that sounds very Swifty to me! -g. ___ swift-evolution mailing list swift-evolution@swift.org https://lists.swift.org/mailman/listinfo/swift-evolution

Re: [swift-evolution] [Pitch] Add an all algorithm to Sequence

2017-04-01 Thread Xiaodi Wu via swift-evolution
On Sat, Apr 1, 2017 at 3:40 AM, David Hart via swift-evolution < swift-evolution@swift.org> wrote: > > On 1 Apr 2017, at 09:50, Brandon Trussell wrote: > > I agree that based on the method name, I thought a collection would be > returned. > > > Now that I think more about it, I think you're right

Re: [swift-evolution] [Pitch] Add an all algorithm to Sequence

2017-04-01 Thread David Hart via swift-evolution
> On 1 Apr 2017, at 09:50, Brandon Trussell wrote: > > I agree that based on the method name, I thought a collection would be > returned. Now that I think more about it, I think you're right. It is confusing. Perhaps: allAre(equalTo: ) allAre(matching: ) >> On Sat, Apr 1, 2017 at 12:36 AM,

Re: [swift-evolution] [Pitch] Add an all algorithm to Sequence

2017-04-01 Thread Vladimir.S via swift-evolution
On 01.04.2017 10:50, Brandon Trussell via swift-evolution wrote: I agree that based on the method name, I thought a collection would be returned. From the other side, for example C# has the similar IEnumerable.All() method which "Determines whether all elements of a sequence satisfy a conditi

Re: [swift-evolution] [Pitch] Add an all algorithm to Sequence

2017-04-01 Thread Vladimir.S via swift-evolution
On 01.04.2017 9:17, Richard Wei via swift-evolution wrote: I agree. But I don’t think the predicate needs an argument label. `membersSatisfy(_:)` or `forAll(_:)` sounds better. checkAll(areEqualTo:) ? -Richard On Mar 31, 2017, at 23:02, Will Stanton via swift-evolution wrote: +1 to add

Re: [swift-evolution] [Pitch] Add an all algorithm to Sequence

2017-04-01 Thread Brandon Trussell via swift-evolution
I agree that based on the method name, I thought a collection would be returned. On Sat, Apr 1, 2017 at 12:36 AM, David Hart via swift-evolution < swift-evolution@swift.org> wrote: > > > > On 1 Apr 2017, at 06:02, Will Stanton via swift-evolution < > swift-evolution@swift.org> wrote: > > > > +1 t

Re: [swift-evolution] [Pitch] Add an all algorithm to Sequence

2017-04-01 Thread David Hart via swift-evolution
> On 1 Apr 2017, at 06:02, Will Stanton via swift-evolution > wrote: > > +1 to adding, but the name `all` suggests (to me) the return of another > sequence, not a Bool. I'm not too concerned because the mandatory labels makes it clear. > Perhaps the function name should be question-like? >

Re: [swift-evolution] [Pitch] Add an all algorithm to Sequence

2017-03-31 Thread Richard Wei via swift-evolution
I agree. But I don’t think the predicate needs an argument label. `membersSatisfy(_:)` or `forAll(_:)` sounds better. -Richard > On Mar 31, 2017, at 23:02, Will Stanton via swift-evolution > wrote: > > +1 to adding, but the name `all` suggests (to me) the return of another > sequence, not a

Re: [swift-evolution] [Pitch] Add an all algorithm to Sequence

2017-03-31 Thread Will Stanton via swift-evolution
+1 to adding, but the name `all` suggests (to me) the return of another sequence, not a Bool. Perhaps the function name should be question-like? Suggesting: `membersSatisfy(condition:)` or `allSatisfy(condition:)` or maybe even just `satisfies(condition:)` The question-like modifier/verb is nec

Re: [swift-evolution] [Pitch] Add an all algorithm to Sequence

2017-03-31 Thread Daniel Duan via swift-evolution
nit: should these names be `all(matching)`/`all(equalTo)` per API Design Guidelines? > On Mar 31, 2017, at 8:28 AM, Ben Cohen via swift-evolution > wrote: > > Hi, > > A short proposal for you as part of the algorithms theme. Hopefully > non-controversial, aside from the naming of the method a

Re: [swift-evolution] [Pitch] Add an all algorithm to Sequence

2017-03-31 Thread Robert Bennett via swift-evolution
That's a good point, but now you've got me wondering whether *those* overloads are necessary either :/ I suppose one reason overloads make more sense to me in the case of index and contains is because those two operations are in fact frequently used to look for a particular element by its value

Re: [swift-evolution] [Pitch] Add an all algorithm to Sequence

2017-03-31 Thread Ben Cohen via swift-evolution
> On Mar 31, 2017, at 4:20 PM, Robert Bennett via swift-evolution > wrote: > > Sorry, despite the curt tone of my initial post, I think this is overall a > great idea. Ben, thanks for drafting the proposal. > No worries! >> On Mar 31, 2017, at 6:12 PM, Ricardo Parada wrote: >> >> I agree.

Re: [swift-evolution] [Pitch] Add an all algorithm to Sequence

2017-03-31 Thread Robert Bennett via swift-evolution
Sorry, despite the curt tone of my initial post, I think this is overall a great idea. Ben, thanks for drafting the proposal. > On Mar 31, 2017, at 6:12 PM, Ricardo Parada wrote: > > I agree. > >> On Mar 31, 2017, at 5:32 PM, Robert Bennett via swift-evolution >> wrote: >> >> I'm don't thi

Re: [swift-evolution] [Pitch] Add an all algorithm to Sequence

2017-03-31 Thread Ricardo Parada via swift-evolution
I agree. > On Mar 31, 2017, at 5:32 PM, Robert Bennett via swift-evolution > wrote: > > I'm don't think we need all(equal:). > 1) For a host of reasons, having a single signature for a function name is > better than having multiple signatures when the single signature is capable > enough. >

[swift-evolution] [Pitch] Add an all algorithm to Sequence

2017-03-31 Thread Robert Bennett via swift-evolution
I'm don't think we need all(equal:). 1) For a host of reasons, having a single signature for a function name is better than having multiple signatures when the single signature is capable enough. 2) A list containing a single distinct element is not a special enough case to check for to warrant

Re: [swift-evolution] [Pitch] Add an all algorithm to Sequence

2017-03-31 Thread Xiaodi Wu via swift-evolution
On Fri, Mar 31, 2017 at 12:14 PM, Joshua Alvarado via swift-evolution < swift-evolution@swift.org> wrote: > Nice addition! > > What do you think of equal parameter named to are? > > nums.all(equal: 9) > > nums.all(are: 9) > > > I think it reads better and adds an explicit action of what is being >

Re: [swift-evolution] [Pitch] Add an all algorithm to Sequence

2017-03-31 Thread Joshua Alvarado via swift-evolution
Nice addition! What do you think of equal parameter named to are? nums.all(equal: 9) nums.all(are: 9) I think it reads better and adds an explicit action of what is being checked. > if nums.all(are: 9) { print("all elements are 9") } On Fri, Mar 31, 2017 at 9:28 AM, Ben Cohen via swift-e

Re: [swift-evolution] [Pitch] Add an all algorithm to Sequence

2017-03-31 Thread Nevin Brackett-Rozinsky via swift-evolution
For “all(equal:)” I think there should be no argument label. We can already write “nums.contains(9)”, so if we add “all” then we should be able to write “nums.all(9)”. Other than that, I like the idea. Nevin ___ swift-evolution mailing list swift-evolut

[swift-evolution] [Pitch] Add an all algorithm to Sequence

2017-03-31 Thread Soroush Khanlou via swift-evolution
I really like this proposal. This is one of the first extensions I add to a new Swift project. I think if we’re going to add `all`, we should consider adding `none` as well. `none` can be used currently as `!contains`, but sometimes boolean logic like that can be hard to follow. Soroush > Hi,

Re: [swift-evolution] [Pitch] Add an all algorithm to Sequence

2017-03-31 Thread Xiaodi Wu via swift-evolution
Agree, this is a nice addition as-is. On Fri, Mar 31, 2017 at 10:42 AM, Sean Heber via swift-evolution < swift-evolution@swift.org> wrote: > I like it. > > l8r > Sean > > > > On Mar 31, 2017, at 10:28 AM, Ben Cohen via swift-evolution < > swift-evolution@swift.org> wrote: > > > > Hi, > > > > A s

Re: [swift-evolution] [Pitch] Add an all algorithm to Sequence

2017-03-31 Thread Sean Heber via swift-evolution
I like it. l8r Sean > On Mar 31, 2017, at 10:28 AM, Ben Cohen via swift-evolution > wrote: > > Hi, > > A short proposal for you as part of the algorithms theme. Hopefully > non-controversial, aside from the naming of the method and arguments, about > which controversy abounds. Online copy

[swift-evolution] [Pitch] Add an all algorithm to Sequence

2017-03-31 Thread Ben Cohen via swift-evolution
Hi, A short proposal for you as part of the algorithms theme. Hopefully non-controversial, aside from the naming of the method and arguments, about which controversy abounds. Online copy here: https://github.com/airspeedswift/swift-evolution/blob/9a778e904c9be8a3692edd19bb757b23c54aacbe/proposa