Each binding introduces a new name/value pair, which can shadow
previous name/value pairs.

I sometimes use let to introduce a modified version of a function
argument or sometimes when I'm conditionally building up a value:

  (let [params [x y]
        params (if some-arg? (conj params z) params)]
    ...)

Now we're on 1.5.1, I'll probably rewrite code like this to use cond->

  (let [params (cond-> [x y]
                       some-arg? (conj z))]
    ...)

(once I've convinced myself that is correct!)

Sean

On Tue, Apr 2, 2013 at 12:09 PM, larry google groups
<lawrencecloj...@gmail.com> 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.
>
>



-- 
Sean A Corfield -- (904) 302-SEAN
An Architect's View -- http://corfield.org/
World Singles, LLC. -- http://worldsingles.com/

"Perfection is the enemy of the good."
-- Gustave Flaubert, French realist novelist (1821-1880)

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