Skip to content

Instantly share code, notes, and snippets.

@adamschmideg
Created July 22, 2014 20:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adamschmideg/133f055ddb1359ed81d0 to your computer and use it in GitHub Desktop.
Save adamschmideg/133f055ddb1359ed81d0 to your computer and use it in GitHub Desktop.
Numerals to roman Coding dojo
(ns romnum.core
(:require
[clojure.test :refer [is testing]]))
(def roman-digits [[1000 "M"]
[500 "D"]
[100 "C"]
[50 "L"]
; [40 "XL"]
[10 "X"]
[5 "V"]
[1 "I"]])
(def roman-digits-map {1000 "M" 500 "D" 100 "C" 50 "L" 10 "X" 5 "V" 1 "I"})
(defn num-to-roman
"Convert a number to roman"
[n]
(if (integer? n) "Not an integer"
"I"
)
)
;; tests
(testing "num-to-roman-test"
(is (= (num-to-roman 1) "I"))
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment