Thursday, June 9, 2011

Learnings from gfunc meeting 8 June 2011

The Glasgow Functional Programming Group (gFunc) held it's second meeting last night.  We were working on the bowling kata in clojure.

Here are a few notes to remind myself and share the things I learned.

(defn- ...) creates a private method

The replicate function does what it says on the tin: 
user=> (replicate 2 10) 
(10 10)
user=> (replicate 2 [1,2])
([1 2] [1 2])

Lein is a good (the preferred?) build tool for clojure https://github.com/technomancy/leiningen

Clojure does not provide (in ruby terms) each_with_index out of the box.  You can code it as map_with_index - https://gist.github.com/17283 - but it seemed last night to promote an imperative style of coding because your solutions end up indexing into a sequence.  Clojure seems much happier iterating over a (potentially infinite) sequence.  I suspect this is more functional style.

The JetBrains IDE has a very nice Clojure plugin.  I must get round to learning it sometime, but I can't really face learning a new IDE.  I'm still mourning Oracle's newly mandated Java focus for NetBeans :-(





No comments:

Post a Comment