While I don't think I'd use it in your particular example, I like it when
it can eliminate superfluous let bindings.
(let [z (as-> (* x x) xsq
...)]
...)
On Mon, Aug 19, 2013 at 10:58 AM, Jay Fields <[email protected]> wrote:
> In the past, I've written code like the following
>
> (defn foo [x y]
> (let [x-squared (* x x)]
> (if (pos? y)
> (+ x-squared y)
> (- x-squared y))))
>
> However, the introduction of as-> has led me to write the following, at
> times
>
> (defn foo [x y]
> (as-> (* x x) x-squared
> (if (pos? y)
> (+ x-squared y)
> (- x-squared y))))
>
> In essence, I've started replacing single binding lets with as->. John
> Hume has pointed out that as-> seems to have been introduced to work
> in conjunction with ->. Which brings me to my question - do you think
> it's better to use a single binding let from a readability
> perspective? Are there any (performance or otherwise) impacts that I
> should be aware of?
>
> Cheers, Jay
>
> --
> --
> 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.
>
--
--
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.