Yup, I've done OOP in the past but probably even closer procedural programming. Recently I've been working pretty much exclusively in python/C++ which are somewhat at two extremes. I'm hoping to see Clojure to be a blend of these two and a replacement especially in areas where things in python are too slow or impossible (parallel stuff). The functional approach of Clojure is the down side for me at the moment ;). The lack of loops and variables is a bit mind-bending, feels like going back to start with programming in general.
kuba On Tue, Aug 20, 2013 at 10:33 PM, Sean Corfield <seancorfi...@gmail.com>wrote: > 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 a topic in the > Google Groups "Clojure" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/clojure/yVOVvgq88hE/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > clojure+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/groups/opt_out. > -- -- 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.