I think a regular "let" is clearer in this kind of case.

"as->" suggests to me that multiple rebindings will happen to the name: if 
that is not happening then it is confusing for readers IMHO.

The only case I can think of where "as->" makes sense and the binding only 
happens once is if you are anticipating/suggesting that more rebindings 
will be inserted later (e.g. you expect additional steps like input 
transformation or output validation to be added).

On Monday, 19 August 2013 22:58:28 UTC+8, Jay Fields 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 clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
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 clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to