> (let [x nil] > ;; do something and modify 'x' > ) > >how does one modify the value of 'x' ?
Hi Chick, there's nothing stopping you re-binding x within the let construct, eg; (defn myfn [x] (let [x (if (or (nil? x) (< x 0.2)) 0.0 x) x (if (>= x 0.8) 1.0 x)] (do-something-with x))) That technique helps a lot of the times you think you need mutable variables. Nested lets are also useful. -Rgds, Adrian. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---