Skip to content

Instantly share code, notes, and snippets.

@shirok
Created September 1, 2011 22:25
Show Gist options
  • Save shirok/1187459 to your computer and use it in GitHub Desktop.
Save shirok/1187459 to your computer and use it in GitHub Desktop.
(defun arabic->roman (n) (if (< 0 n 4000) (format nil "~@R" n) (error "oob")))
(let ((tab (loop for n from 1 to 3999 collect `(,(format nil "~@R" n) . ,n))))
(defun roman->arabic (r) (or (cdr (assoc r tab :test #'equalp)) (error "huh?"))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment