yes, but you can not change it if you start a new (let ...). On 28 Aug., 16:22, HB <hubaghd...@gmail.com> wrote: > So, any time I want to declare a local variable (inside a function for > example), I use let form. > > On Aug 26, 8:26 pm, nickikt <nick...@gmail.com> wrote: > > > Its for defining look variables (constants) that you use more then > > once in your form and not have to write it more then once (or > > calculated it more then once) > > (let [r1 (random-int) > > r2 (random-int)] > > (when (the-same? r1 r2) > > (str r1 " and " r2 " are the same")) > > > Write this without let > > > (when (the-same? (random-int) (random-int)) > > (str (random-int) " and " (random-int) " are the same")) > > > does this work? Of course not and thats one reason for let. > > > Also it can make your code cleaner. > > > (filter even? (take 10 (drop 10 (map inc (iterate inc 1))))) ;stuff > > like this can get long > > > (let [N-plus-one (map inc (iterate inc 1)) > > my-range (take 10 (drop 10 N-plus-one))] > > (filter even? my-range)) > > > You can do destructoring in the binding > > block.http://clojure.org/special_forms > > (search destructoring) > > > Thats just some stuff, but as soon you have done some stuff yourself > > it will become clear. > > > On 26 Aug., 17:02, HB <hubaghd...@gmail.com> wrote: > > > > Hey, > > > Basically, I understand what let form does but I'm not sure when to > > > use it. > > > Would you please enlighten me about it? (if possible some typical Java > > > code and then covert it to Clojure let form). > > > I really appreciate your time and help. > > > Thanks.
-- 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