On Tue, May 26, 2009 at 9:11 AM, Sean Devlin <francoisdev...@gmail.com> wrote: > > To add to my own post: > > There is also a discrepancy in what is returned from the two > > (some identity [1 2 3]) -> 1 > (every? identity [1 2 3]) -> true
The naming difference matches the behavior difference. The ? in 'every?' suggests it returns true or false. 'some' has no ? precisely because it may return other values. > Granted, it's all the same to an if statement. However, current > behavior of some has the added use: > > (first (filter identity [1 2 3])) -> 1 > (some identity [1 2 3]) -> 1 Indeed it can be useful. And rarely does it cause problems (in my experience) that 'some' may return something other than a Boolean. > Is the equivalence a fluke, or is this by design? Is there any > promise that some will continue to behave this way in the future? If > so, it seems like a bad alias for (first (filter...)) It's not an alias for (first (filter ...)), bad or otherwise: user=> (some #(when (even? %) (/ % 2)) [1 3 5 6]) 3 user=> (first (filter #(when (even? %) (/ % 2)) [1 3 5 6])) 6 They behave differently, as documented. --Chouser --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~----------~----~----~----~------~----~------~--~---