Posted by Matt on May 21, 2010
RailsConf / May Update
June is quickly approaching and that means one thing… RailsConf. This will be the first professional conference I’ve ever attended and I’m extremely excited for it. I will be taking in the Mobile App Development Studio from Mike Clark and the Rails 3 Ropes Course from the guys at Envy Labs.
I’ve spent most of my time recently working in Cocoa (which I love) and haven’t been able to devote the time I’ve wanted to Rails. I’ve only scratched the surface of Rails 3 but I’m extremely excited for templates. I will happily be dumping ActiveRecord and ERB for DataMapper (maybe CouchRest as well?) and HAML.
I’ve put learning Scala on hiatus for a little while. I’ve started learning Clojure instead. I’ve always had a bit of a hard time with LISP based languages. However, I think I get Clojure’s implementation of it a lot better. I’m using Programming Clojure by Stuart Holloway as my guide. It’s actually a lot of fun when you get into it. I’m still however having trouble reading my own code after not touching it for a few days. All of the parenthesis can be a bit hard to grok.
Here is an example of generating a Fibonacci sequence then summing all even numbers found. This is a potential solution to Project Euler Problem No. 2
#!/usr/bin/env clj(defn fib
“Fibbonacci sequence for numbers greater than 2”
[n]
((fn
[max, sequence]
(let [sequenceCount (count sequence) firstIndex (- sequenceCount 1) secondIndex (- sequenceCount 2)
newFibNumber (+ (sequence firstIndex) (sequence secondIndex))]
(if (> newFibNumber max)
sequence
(recur max (conj sequence newFibNumber)))))
n [1 1]))(println (reduce + (filter #(= (rem % 2) 0) (fib 4000000))))
If you want to more about Clojure, definately check out the Programming Clojure book or the Clojure Peepcode Screencast
Continue Reading…