Skip to main content
26 events
when toggle format what by license comment
Jul 3, 2023 at 23:08 history unprotected Mason Wheeler
Jan 31, 2019 at 15:02 comment added Gil Sand @KolobCanyon Because on stackoverflow the answer would've been one single line explaining what Any actually does, and not my actual question which is "why would you do it" and not "what does it do ?"
Jan 30, 2019 at 19:20 comment added Kellen Stuart Why is this not a question on stackoverflow?
Oct 23, 2018 at 9:23 comment added Gil Sand With 3 more years of experience behind me (it was my second year of development back in 2015), I do not have the same point of view I had back in the day. After re-reading the question I wrote, I now completely disagree with the intent being unclear.
Oct 6, 2015 at 7:36 vote accept Gil Sand
Sep 7, 2015 at 7:46 comment added phresnel @JacquesB: Personally, I associate any/none/all with checking for a condition on a list, but not with the meaning of "has any". Probably because there is no symmetry between "list.empty"=="list is empty", and "list.any"=="list has any". Whereas upon a list, it reads "if any true in list", "if none true in list", "if all true in list". I guess it's that symmetry that makes it less intuitive to me. Personally, while I find it uglier, but I think I would prefer if they'd just stick to "list.hasXXX", "list.isXXX" naming convention, looks less leet, but is less ambiguous.
Sep 6, 2015 at 11:58 comment added JacquesB @phresnel: Empty() works when there is no predicate but reads really strange when a predicate is supplied. Any() works in both cases and have a nice symmetry with All(), and the Any()/All() pair have precedence in other languages.
Sep 6, 2015 at 11:53 comment added JacquesB @SargeBorsch: The SQL parallel to Any is Exists. The Linq name is probably more inspired by Haskell and Python which also have any/all functions.
Sep 6, 2015 at 9:53 comment added jk. @SargeBorsch any is the same in haskell?
Sep 5, 2015 at 19:49 comment added Andy @BlueRaja-DannyPflughoeft i agree. I think any is more clear since it eliminates a what could be considered a magic number.
Sep 5, 2015 at 18:31 history protected gnat
Sep 5, 2015 at 15:07 answer added JacquesB timeline score: 9
Sep 5, 2015 at 8:14 comment added Davor Ždralo @SargeBorsch - only if you prefer Heskel/functional naming, which most people don't.
Sep 5, 2015 at 7:29 comment added Display Name they are not well-named because they are trying to mimic SQL. (select instead of map, aggregate instead of fold, where instead of filter, etc.); in Haskell this is a lot better.
Sep 5, 2015 at 6:18 comment added phresnel In some regards, these functions are not well-named. In C++, it would have been if (!list.empty()), which seems more related to a list being empty or not. While I am not usually into negating things, list not empty is clearer to me than list any. Surely, if you insert a list _has_ any, it's clearer. But then, Any also has other meanings, e.g. "any true", and you have to put it in mentally, already knowing what "Any" does.
Sep 5, 2015 at 5:57 review Close votes
Sep 14, 2015 at 3:04
Sep 4, 2015 at 23:14 answer added maaartinus timeline score: 4
S Sep 4, 2015 at 22:16 history suggested Peter Mortensen CC BY-SA 3.0
Copy edited (e.g. ref. <http://english.stackexchange.com/questions/4645/is-it-ever-correct-to-have-a-space-before-a-question-or-exclamation-mark#comment206109_4645>).
Sep 4, 2015 at 22:04 review Suggested edits
S Sep 4, 2015 at 22:16
Sep 4, 2015 at 21:32 comment added BlueRaja - Danny Pflughoeft I challenge your claim that Any() is less clear: Any() seems more clear to me, especially with a lambda-condition. Translating code to English in my head, if(MyList.Count(o => o > 10) > 0) becomes "Is the number of items greater than 10 more than 0?" whereas if(MyList.Any(o => o > 10)) becomes "Are there any items greater than 10?"
Sep 4, 2015 at 20:26 history tweeted twitter.com/#!/StackProgrammer/status/639897379018252289
Sep 4, 2015 at 19:40 comment added jk. in what way is any less clear on intent?
Sep 4, 2015 at 18:28 answer added sstan timeline score: 11
Sep 4, 2015 at 18:26 answer added Sign timeline score: 65
Sep 4, 2015 at 18:21 answer added Mason Wheeler timeline score: 112
Sep 4, 2015 at 18:16 history asked Gil Sand CC BY-SA 3.0