I had the exact same problem transitioning from OOP to Lisp, and I can only offer my own experiences. I finally "understood" lisp, by programming a new pet project FROM SCRATCH, in the most STRAIGHTFORWARD way possible. I originally started by porting over a program I had written in Java, and found that that did not help my understanding at all. -Patrick
On Sep 3, 12:12 pm, HB <hubaghd...@gmail.com> wrote: > Really nice example Peter, > Thanks, I appreciate it. > > On Sep 3, 6:36 am, Peter Buckley <buckmeist...@gmail.com> wrote: > > > > > I'm only a little ways through Joy of Clojure (my first Clojure book) > > but bear with me as I'm thinking aloud on what it means for me to > > "think in Clojure." I hope list members will forgive me if I get > > things wrong - and please correct my working concept(s) as well. > > > One of the things that stuck out for me that I heard somewhere (can't > > remember exactly) was that OOP is about framing questions in terms of > > "nouns" and FP is about framing questions in terms of "verbs." > > > Partly for my own benefit (and the list's critique and refinement) I > > want to talk about this as it relates to an example. The first task > > I'm working on in Clojure is taking a text file which is sortof a > > template, and then removing/adding/changing certain lines/strings in > > it based on an xml kindof config file, in the end spitting out an > > improved text file. > > > If I was in the OOP frame of mind, I would have a class to represent > > my text file, and a class to represent my xml file. There would > > possibly be a shared base class to let me share the common slurping > > (reading of lines) from the files. As verb-y as that is (I hope > > Clojure is polluting my thought process already!) the base class would > > probably be called "File" or something super noun-y. In any case, the > > classes, the files, these are all "nouns." > > > But in the FP frame of mind, I just have data or information, and the > > focus is on the transformations that I do with the data. The > > transformations are things like zip-my-xml-into-a-struct-map or > > read-my-lines-into-a-seq and replace-text-values-with-xml-values. The > > focus is on the actions (verbs being action words), and the functions > > are essentially the "verbs." > > > I feel like I'm starting to get the concept of thinking in a > > function-al way, although I have a lot of work to do yet on learning > > Clojure the language. > > > HTH, > > Peter > > > On Thu, Sep 2, 2010 at 10:02 PM, Wilson MacGyver <wmacgy...@gmail.com> > > wrote: > > > I highly recommend "Joy of Clojure". It's a good "2nd book on clojure". > > > It shows you the "why things are the way they are", and how to > > > do things the clojure way as much as possible. > > > > On Thu, Sep 2, 2010 at 9:29 PM, HB <hubaghd...@gmail.com> wrote: > > >> Hey, > > >> I finished reading "Programming Clojure" and "Practical Clojure" and > > >> I'm hooked :) > > >> Please count me in the Clojure club. > > >> But I failed how to think in Clojure. > > >> My main career is around Java web applications (Hibernate, Spring, > > >> Lucene) and Web services. > > >> Lets not talk about Java web frameworks neither Clojure ones, I want > > >> to talk in general. > > >> Usually we create some domain entities, map them with Hibernate/ > > >> iBatis. > > >> I don't know how a Clojure application would be build without objects. > > >> I think Scala really shines here, this OOP/FP is really powerful > > >> approach (please note I'm not saying Clojure isn't good, I don't seel > > >> flame war) > > >> How to think in Clojure? how to achieve this shift? > > > > -- > > > Omnem crede diem tibi diluxisse supremum. > > > > -- > > > 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 > > > -- > > The king’s heart is like a stream of water directed by the Lord; He > > guides it wherever He pleases. -- 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