4 ms·
I think 'every' and 'some' are reasonable analogues, but the choice to make the implementations and hence their suffixes asymmetric wrt 'truthiness handling' is
by disconcision 7y ago
I think 'every' and 'some' are reasonable analogues, but the choice to make the implementations and hence their suffixes asymmetric wrt 'truthiness handling' is confusing to me, especially since these functions have existed (symmetrically) for a while in various schemes under the names 'conjoin' and 'disjoin'
- drcode 7y agoI agree that I'd be far more likely to use these if they were named "conjoin" and "disjoin".
- TeMPOraL 7y agoThese names are even worse. I know Clojure likes this style, but to me, "conjoin" is just a fancy way of writing "join" if you want another distinct symbol naming the same, very generic concept. "some" and "every" create nicely readable code. "every-pred" and "some-fn" could be called "satisfies-every" and "satisfies-some", respectively.
- fogus 7y agoI wrote both of these functions and conjoin and disjoin were definitely considered but were ultimately dismissed to avoid confusion with `conj` and `disj`. The chosen names were meant to echo `some?` and `every?`.
- thom 7y agoI personally don't find it that hard remembering them. I am sure all of Clojure's names could be more regimented, but I will still never forget how much I laughed when someone tried to tell me how well designed the Haskell lens operators were: https://hackage.haskell.org/package/lens-4.18.1/docs/Control-Lens-Operators.html https://hackage.haskell.org/package/lens-4.18.1/docs/Control...
- tome 7y agoThis article explains the rationale behind the naming scheme. It's quite regular. https://gist.github.com/ChrisPenner/1f7b6923448b3396a45d04a2b6b9d066#optics-by-example-cheat-sheets https://gist.github.com/ChrisPenner/1f7b6923448b3396a45d04a2...
- thom 7y agoYes, I understand it's regular. It doesn't stop it being an absolute abomination. My point is that having regularity in naming doesn't stop an API being horrible, and not having regularity in naming doesn't _make_ an API horrible.
- disconcision 7y agodigging into the clojure core implementation, it looks like this asymmetry originates with 'every?' versus 'some', which test predicates against collections, the former being boolean, and the later returning the first non-falsy element. again, this feels a little non-committal; it's true that the not-strictly-boolean behavior of the disjunctive forms is handier than the conjunctive ones, but the latter can still come in handy.
- drcode 7y agoThe irregular naming of "some" vs "some?" has been the source of several tricky bugs for me in the past, and I suspect many other Clojurians would report this as well.