Slowly getting the hang of Clojure

| geek

At least in terms of 4clojure problems. =) I've worked my way through the elementary and easy problems (woohoo!), with 88 exercises completed so far. It took me a while to get the hang of lazy-seq, since Emacs Lisp doesn't do lazy evaluation. Once I started thinking of it as a macro, though, I finally got the hang of it. Here's my solution for the exercise for reimplementing map:

(fn my-map [func input]
      (if (sequential? input) 
        (cons (func (first input))
              (lazy-seq (my-map func (next input))))))

There are more exercises to do, and it's fun to feel the different concepts start coming together. I might not do the hard exercises, though. I still haven't thought of any practical purposes I'd like to use it for, though…

You can comment with Disqus or you can e-mail me at sacha@sachachua.com.