2010/11/24 Mike Meyer <[email protected]> > On Wed, 24 Nov 2010 22:51:09 +0100 > Daniel Werner <[email protected]> wrote: > > > On 24 November 2010 21:40, Mike Meyer > > <[email protected]> wrote: > > > Could someone explain where this urge to write (-> expr (func arg)) > > > instead of (func expr arg) comes from? > > > > I like to use -> and ->> because they allow me to add more steps to > > the "pipeline" as needed, without requiring ever more deeply nested > > parentheses. Of course, the examples you cited were intentionally > > trivial > > Those cases weren't "intentionally trivial", they were the > point. What's the motive for using -> when there's only one form after > the expression? I get why you'd do it with two or more forms - it > reduces the nesting, and reading left-to right follows the evaluation > order. But with just one form it's liable to have the opposite effect > on nesting, and it makes the evaluation order read zig-zag. >
I don't know. -?> could have its use, since it would prevent throwing a NullPointerException if the receiver is null, but plain -> .. ? -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to [email protected] Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/clojure?hl=en
