Hmm, good point, especially the `let` one... What is `as->`? I can't find
anything about that.
There is one benefit over `let` though: it is more explicit. Let allows you
to define independent bindings mixed together with multiple threads of
dependent bindings (which can be mixed in random combinations). As the
number of bindings increase it becomes quite messy, and hard to decipher
which line depends on which. I have seen, even written myself (shame on
me), such code. I feel that this is the main reason for the `core`
threading macros too ("why not use let instead?" would still apply then).
On the other hand as my simple example code demonstrates (off the top of my
hat, cuz ya need to show da code!), in a functional language the parameter
order shouldn't matter, and there shouldn't be privileged (main!?)
parameter positions (Clojure is the landguage of multimethods after all!)
(BTW, have you noticed you can do destructuring with ->>> out of the box ;)
Anyway, I see the reason for -> and ->> macros and indeed the first and
last positions are special in some sense. The -> is good for navigating
protocols, and ->> is good for functions expected/designed to be partially
applied. Is that correct?
Cheers,
Daniel
On Sunday, July 14, 2013 5:39:18 PM UTC+1, Jeremy Heiler wrote:
>
> On Sat, Jul 13, 2013 at 10:49 PM, Daniel Dinnyes
> <[email protected]<javascript:>>
> wrote:
> > (->>> "test-string-with-lots-of-dashes"
> > x (s/split x #"-")
> > y (interleave y (range))
> > z (s/join #"_" z)
> > z (s/join " * " ["I am serious" z "Not Kidding!!" z]))
>
> Why not use as-> or a let in this situation?
>
--
--
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
---
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.