As an example:
"But watch out if you try to pop nothing"
(= __ (try
(catch IllegalStateException e "No dice!")))
Problem in /home/clueless/clojure-koans/src/koans/02_lists.clj
But watch out if you try to pop nothing
(= __ (try (pop (quote ())) (catch IllegalStateException e "No dice!")))
I agree it does make it easier to solve when you can see what you're trying to evaluate to. It was actually a conscious decision to make that not be the case, because it seemed too easy to just fill in the blanks without thinking about what should go there.
This is basically the worst part of Clojure (and only on the JVM at that): catching a Java exception.
I know that's not your point but --and I'm a huge Clojure fan-- seeing a Java idiosynchrasy like that one makes me want to give up Clojure : (
"Conjoining an element to a list can be done in the reverse order"
(= __ (conj '(:a :b :c :d :e) 0))
e.g. (conj '(:a :b :c) :d :e :f) returns
(:f :e :d :a :b :c)
git clone firstname.lastname@example.org:functional-koans/clojure-koans.git
lein koan run
I remember I did: the koans first, then tried several exercises on the 4clojure website, then learned about Leinengen and only then I moved into 'projects'.
Unless they expect the new user to spend significant time learning about that tool before moving on to their koans, I think it'd really be much better to have a short how-to for that.
Learn Leiningen- not only because it makes Clojure simple and pleasurable to use, but because it'd be a fantastic tool no matter what language it was part of.
Project skeletons (new new), command line scripting (via lein exec), deployment, the wonderful 'lein ring server', custom plugins... and for those who just want to get their feet wet, 'lein repl' brings the ocean to you.
Kudos to the authors, and you have a thumbs up from me.
- find a function / aspect of Clojure that calls my attention
- read the doc / try to understand the rationale
- give it a sample use case, try to connect it with previous lessons
Now I'm into 4clojure to keep on practising the syntax and to get my mind to think _the functional way_
Any other resource to be suggested?
I need to revisit them, but the thornier (for me) problems kept distracting me from other work.