Skip to content

Instantly share code, notes, and snippets.

@shirok
Created September 1, 2011 22:34
Show Gist options
  • Save shirok/1187485 to your computer and use it in GitHub Desktop.
Save shirok/1187485 to your computer and use it in GitHub Desktop.
(use srfi-1)
(use slib)
(require 'format)
(define (arabic->roman n) (if (< 0 n 4000) (format "~@R" n) (error "oob")))
(define roman->arabic
(let1 tab (map (^n `(,(format "~@R" n) . ,n)) (iota 3999 1))
(^r (cond [(assoc r tab string-ci=?) => cdr] [else (error "huh?")]))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment