Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Clojure Kata #3 – Roman Numerals (elegantcode.com)
14 points by javinpaul on May 22, 2014 | hide | past | favorite | 3 comments


If you'd like to see interesting solutions to this problem, I recommend solving this 4clojure exercise:

http://www.4clojure.com/problem/104

and then looking at solutions by experienced Clojurians. Some are code golf but still worth understanding (e.g chouser's, who is one of the authors of The Joy of Clojure).


"The reason I wanted to try the solution that I posted is that I didn't want to include IV, IX, XC, ... into the list of symbols as they are made up of base symbols (just for the sake of the exercise)."

An interesting choice - it seems to make the problem harder than it should be.

This is really solvable in about 6-8 lines of code otherwise.


When learning a Lisp, you have to be careful of the habit of placing ending parenthesis/brackets on new lines like you would in C and Java.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: