2017-03-03 15:06:49 -05:00
|
|
|
;; A list containing the values of single-letter Roman numerals.
|
2017-03-07 16:41:26 -05:00
|
|
|
(setq roman-number-list
|
2017-03-06 11:00:18 -05:00
|
|
|
'((I 1) (V 5) (X 10) (L 50) (C 100) (D 500) (M 1000)))
|
2017-03-03 15:06:49 -05:00
|
|
|
|
|
|
|
;; Converts a single Roman numeral letter into its equivalent decimal value.
|
|
|
|
(defun letter-to-decimal (letter)
|
|
|
|
(car
|
|
|
|
(cdr
|
|
|
|
(
|
|
|
|
(lambda (lst f)
|
|
|
|
(cond
|
|
|
|
((null lst) ())
|
|
|
|
((eq (car (car lst)) letter) (car lst))
|
2017-03-06 11:00:18 -05:00
|
|
|
(t (funcall f (cdr lst) f))))
|
2017-03-03 15:06:49 -05:00
|
|
|
roman-number-list
|
|
|
|
(lambda (lst f)
|
|
|
|
(cond
|
|
|
|
((null lst) ())
|
|
|
|
((eq (car (car lst)) letter) (car lst))
|
2017-03-06 11:00:18 -05:00
|
|
|
(t (funcall f (cdr lst) f))))))))
|