On Saturday, November 8, 2014 10:15:12 PM UTC-5, Blake McBride wrote:
>
> Greetings,
>
> I have a sense that there is value in immutable variables and data but
> that value is unneeded in my application and more than a nuisance. How can
> I create a "let" that creates mutable locals that I can easily get the
> value from and set a new value? Presumably, I can hide the mess in a few
> macros.
>
>
Maybe I missed this in one of the replies, or maybe it's not what you're
looking for, but this works:
~~~clojure
#!/usr/bin/env lein-exec
(defn make-rands
[n]
(let [some-local (atom [])]
(dotimes [_ n]
(swap! some-local conj (rand-int 10)))
@some-local))
(println (make-rands 10))
~~~
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
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 [email protected].
For more options, visit https://groups.google.com/d/optout.