I have used it habitually because it contriubutes more to readability to 
reuse the same name than force yourself to invent new names for something 
that is conceptually the same, just transformed to match some formalities, 
like coercing strings to integers or keywordizing them.

A second way this contributes to readability is reducing the mental load by 
making it obvious that the earlier value will not be needed in the rest of 
the function code.

This idiom is useful enough to have gotten its own macro in 1.5:

(as-> (+ 1 1) mega
   (+ 1 mega)
   (+ 1 mega)
   (+ 1 mega)
   (+ 1 mega))

It expands to the exact form you have posted.

-marko

On Tuesday, April 2, 2013 9:09:25 PM UTC+2, larry google groups wrote:
>
>
> If Clojure is suppose to emphasize immutability, why can I do this: 
>
> kiosks-clojure.core=> (let [
>                  #_=> mega (+ 1 1)
>                  #_=> mega (+ 1 mega)
>                  #_=> mega (+ 1 mega)
>                  #_=> mega (+ 1 mega)
>                  #_=> mega (+ 1 mega)]
>                  #_=> mega)
> 6
>
> I might as well be writing PHP code. 
>
> Does anyone actually write Clojure code like this, or is it considered bad 
> form? 
>
>
>

-- 
-- 
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