Monday, May 14, 2012

fun with clojure / lisp

(fn last_element [x] (nth x (- (count x) 1)))

Someone out there invented this language. That someone was not a normal person.

2 comments:

Jeff said...

there's already a builtin called last.

Not sure what about the function you wrote is so "abnormal".

Jim Cheesman said...

Nothing abnormal for a lispy language, but coming from Java it's just plain weird :)

(And yes, I know about "last", it was a 4Clojure exercise).