--
You received this message because you are subscribed to the Google Groups "scala-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scala-user+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
while i agree, i still think there could be 2 methods (select & reject) which just call filter & filternot...
while i agree, i still think there could be 2 methods (select & reject) which just call filter & filternot...
(in my own code, i use a delegate "select" instead of "filter")
Gesendet: Donnerstag, 21. März 2013 um 14:56 Uhr
Von: "Jiayu Liu" <jime...@gmail.com>
An: "Flavio W. Brasil" <fwbr...@gmail.com>
Cc: scala-user <scala...@googlegroups.com>
Betreff: Re: [scala-user] filter/filterNot
While I quite agree with you, it's kind of hard to make these changes, and the reason is quite simple: it's just convention, just like P and V in semaphore. Filter is a often seen in other precedent languages like Haskell.
On Thu, Mar 21, 2013 at 9:21 PM, Flavio W. Brasil <fwbr...@gmail.com> wrote:
I think that filter/filterNot aren't good names for collections operations. I always get in doubt if they select or reject items.Would not be better to rename them to "select" (filter) and "reject" (filterNot), like in Smalltalk?
--
You received this message because you are subscribed to the Google Groups "scala-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scala-user+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
--
Having too many ways to do the same thing ends up adding confusion, not subtracting it, especially when multiple people work on the code.
--
--
You received this message because you are subscribed to a topic in the Google Groups "scala-user" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/scala-user/InI6uM0Rv9c/unsubscribe?hl=en.
To unsubscribe from this group and all its topics, send an email to scala-user+unsubscribe@googlegroups.com.
Ignoring that "to filter" and "to filter out" are considered synonyms?AFAICS, the only real issue is that the word "filter" by default has negative connotation as in "remove whatever matches to this predicate" but in tha API it actually means the opposite: "remove whatever doesn't match to this predicate", or, and this is why "select" (positive connotation) is proposed: "take/keep whatever match to this predicate".filterNot just adds problems... double reversing the meaning of "filter"... it gives a lot to think to newcomers :)But as others have said... this is very unlikely to change anyway... so we're just wasting time, bandwidth and storage.
On Thu, Mar 21, 2013 at 4:22 PM, Jan Vanek <j3v...@gmail.com> wrote:
On 21.03.2013 19:37, Erik Osheim wrote:
On Thu, Mar 21, 2013 at 11:36:23AM -0700, Som Snytt wrote:
Personally, I'd have gone with "filterFor" and "filterOut".Yeah, or even filterInto and filterOut or something.
I like filterOut too. Having filter and filterOut (i.e. rename filterNot to filterOut) would be good enough, IMO.
-- Erik
--
You received this message because you are subscribed to a topic in the Google Groups "scala-user" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/scala-user/InI6uM0Rv9c/unsubscribe?hl=en.
To unsubscribe from this group and all its topics, send an email to scala-user+unsubscribe@googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "scala-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scala-user+...@googlegroups.com.
Ignoring that "to filter" and "to filter out" are considered synonyms?
AFAICS, the only real issue is that the word "filter" by default has negative connotation as in "remove whatever matches to this predicate" but in tha API it actually means the opposite: "remove whatever doesn't match to this predicate", or, and this is why "select" (positive connotation) is proposed: "take/keep whatever match to this predicate".
filterNot just adds problems... double reversing the meaning of "filter"... it gives a lot to think to newcomers :)
But as others have said... this is very unlikely to change anyway... so we're just wasting time, bandwidth and storage.
On Thu, Mar 21, 2013 at 4:22 PM, Jan Vanek <j3v...@gmail.com> wrote:
On 21.03.2013 19:37, Erik Osheim wrote:
On Thu, Mar 21, 2013 at 11:36:23AM -0700, Som Snytt wrote:
Personally, I'd have gone with "filterFor" and "filterOut".Yeah, or even filterInto and filterOut or something.
I like filterOut too. Having filter and filterOut (i.e. rename filterNot to filterOut) would be good enough, IMO.
-- Erik
--
You received this message because you are subscribed to a topic in the Google Groups "scala-user" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/scala-user/InI6uM0Rv9c/unsubscribe?hl=en.
To unsubscribe from this group and all its topics, send an email to scala-user+...@googlegroups.com.
I agree with your points, and I joined the thread only because I too had to inspect the source of filter/filterNot, and the existence of filterNot added significantly to my confusion. On the other hand I don't like select and also reject,On 21.03.2013 21:35, Pablo Lalloni wrote:
Ignoring that "to filter" and "to filter out" are considered synonyms?
AFAICS, the only real issue is that the word "filter" by default has negative connotation as in "remove whatever matches to this predicate" but in tha API it actually means the opposite: "remove whatever doesn't match to this predicate", or, and this is why "select" (positive connotation) is proposed: "take/keep whatever match to this predicate".
filterNot just adds problems... double reversing the meaning of "filter"... it gives a lot to think to newcomers :)
I think filter is actually not that bad, apart from the fact that as you say, filter is unlikely to change. I like filterOut because it makes clear that elements which match the predicate will be filtered out, so the existence of filterOut dissolves my small uncertainty about filter, whereas filterNot does not do that job, in fact it does the opposite for me, personally.
But as others have said... this is very unlikely to change anyway... so we're just wasting time, bandwidth and storage.
On Thu, Mar 21, 2013 at 4:22 PM, Jan Vanek <j3v...@gmail.com> wrote:
On 21.03.2013 19:37, Erik Osheim wrote:
On Thu, Mar 21, 2013 at 11:36:23AM -0700, Som Snytt wrote:
Personally, I'd have gone with "filterFor" and "filterOut".Yeah, or even filterInto and filterOut or something.
I like filterOut too. Having filter and filterOut (i.e. rename filterNot to filterOut) would be good enough, IMO.
-- Erik
--
You received this message because you are subscribed to a topic in the Google Groups "scala-user" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/scala-user/InI6uM0Rv9c/unsubscribe?hl=en.
To unsubscribe from this group and all its topics, send an email to scala-user+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
--
You received this message because you are subscribed to the Google Groups "scala-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scala-user+...@googlegroups.com.
On Thu, Mar 21, 2013 at 5:41 PM, Nils Kilden-Pedersen <nil...@gmail.com> wrote:
> On Thu, Mar 21, 2013 at 4:12 PM, Jan Vanek <j3v...@gmail.com> wrote:
>>
>> On 21.03.2013 21:35, Pablo Lalloni wrote:
>>
>> Ignoring that "to filter" and "to filter out" are considered synonyms?
keepIf/tossIf
>
>
> It could be any number of alternatives, e.g. include/exclude, keep/toss,
> etc.
On Thu, Mar 21, 2013 at 4:12 PM, Jan Vanek <j3v...@gmail.com> wrote:I agree with your points, and I joined the thread only because I too had to inspect the source of filter/filterNot, and the existence of filterNot added significantly to my confusion. On the other hand I don't like select and also reject,On 21.03.2013 21:35, Pablo Lalloni wrote:
Ignoring that "to filter" and "to filter out" are considered synonyms?
AFAICS, the only real issue is that the word "filter" by default has negative connotation as in "remove whatever matches to this predicate" but in tha API it actually means the opposite: "remove whatever doesn't match to this predicate", or, and this is why "select" (positive connotation) is proposed: "take/keep whatever match to this predicate".
filterNot just adds problems... double reversing the meaning of "filter"... it gives a lot to think to newcomers :)
It could be any number of alternatives, e.g. include/exclude, keep/toss, etc.
On Thu, Mar 21, 2013 at 2:45 PM, Oliver Ruebenacker <cur...@gmail.com> wrote:On Thu, Mar 21, 2013 at 5:41 PM, Nils Kilden-Pedersen <nil...@gmail.com> wrote:
> On Thu, Mar 21, 2013 at 4:12 PM, Jan Vanek <j3v...@gmail.com> wrote:
>>
>> On 21.03.2013 21:35, Pablo Lalloni wrote:
>>
>> Ignoring that "to filter" and "to filter out" are considered synonyms?
We filter water but we filter out impurities.
keepIf/tossIf
>
>
> It could be any number of alternatives, e.g. include/exclude, keep/toss,
> etc.
Canonically, partition._1 and partition._2.