On Tue, Aug 20, 2013 at 9:31 PM, Kuba Roth <kuba.r...@gmail.com> wrote: > The reason I looked into 'intern' can only be explained by totally lack of > experience in Clojure and more general functional programming.
Ah, is your background OOP? You'll find the functional world is pretty different. No "variables" in the traditional sense, no uncontrolled mutation, no "loops" in the traditional sense, no state in the OOP sense. def and defn only create top-level definitions - bindings of values to symbols - and intern is really an implementation detail that you want to keep away from. As you can see from my example, you can create a sequence of agents easily enough as a data structure, and then you can perform operations on that data structure. Agents provide controlled mutation in that they start out with an initial value and you send them a series of function invocations and they take on new values as each function invocation is applied asynchronously. I wonder what you might be trying to achieve? Or perhaps this is just initial experimentation? One thing you'll find about Clojure is how rarely you need mutation. At World Singles we have about 18,000 lines of Clojure with just two agents (used to provide measured asynchronous DB updates for a couple of very specific situations) and 27 atoms, which are nearly all just caches - only half a dozen of those are really "mutable state" (and we're consolidating that). Welcome to Clojure! -- 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.