And also from that site the Haskell version is pretty neat though
somewhat esoteric!

(defn digit [x y z k]
  (condp = k
    1 [x]
    2 [x x]
    3 [x x x]
    4 [x y]
    5 [y]
    6 [y x]
    7 [y x x]
    8 [y x x x]
    9 [x z]))
(defn tim-roman
  [n]
  (cond
    (= n 0) ""
    (>= n 1000) (cons \M (tim-roman (- n 1000)))
    (>= n 100) (concat (digit \C \D \M (quot n 100)) (tim-roman (mod n
100)))
    (>= n 10) (concat (digit \X \L \C (quot n 10)) (tim-roman (mod n
10)))
    :else (digit \I \V \X n)))
(defn str-roman
  [n]
  (apply str (tim-roman n)))

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to