HB <hubaghd...@gmail.com> writes:

> OMG, this is too much Clojure code for me to handle O.o
> Alex, you just killed me :)

Hehe, sorry.  Just thought it might be helpful to show the progression
of dealing with all the little edge cases.

It perhaps looks much more fiddly, but you're doing more there than
common lisp:  sequences are an abstraction, so you can use 
that function on any collection type, not just lists.

Laziness can also be incredibly useful (but maybe not for this
particular example).  I often find myself and colleagues having to
totally restructure report generating Ruby/Perl/Python scripts because
they eagerly loaded everything into memory.  Usually the "natural" way
they would have been written in Clojure would have avoided the problem.

Of course you don't get those benefits completely free.  A little extra
up front complexity which then makes things so much simpler when it
comes to polymorphism, concurrency or larger than memory data sets.

For that reason I don't see Clojure replacing say Ruby or Python for small
database backed webapps where you don't have to worry about that sort of
thing.  It's a different niche.

> Do you previous Lisp knowledge? or Clojure is your first Lisp? you are
> so good.

Clojure is the first lisp I really "learned" properly.  Before Clojure
I'd very briefly played with Common Lisp and some "lisps as
configuration" (Emacs, Sawfish etc), but never really got too far beyond
"hello world".

I was however fairly fluent in C, Python, Java and Haskell which I think
probably helped a lot:

* C: data structures, how things work "under the hood", concurrency
  (locks, semaphores, pthreads, openmp)

* Python: dynamic typing, first class functions, GC, REPL

* Java: JVM tools and standard library

* Haskell: functional programming, immutability, lazy evaluation,
  destructuring.


So "learning Clojure" for me was basically adding these on top:

* Lisp syntax

* Macros

* Clojure "state" management (vars, refs, atoms, agents etc)

* Concurrency features (pmap, future, promise etc)

* Clojure-style datatypes/protocols


I think people with a Common Lisp background might actually have a
harder time.  The syntax might make it feel similar, but Clojure is
really in many ways a very different language.

-- 
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

Reply via email to