s c h e m e w i k i . o r g

/ Scm.recipe-decToroman

This Web


WebHome 
WebChanges 
WebTopicList 
WebStatistics 

All Webs


Chicken
Cookbook
Erlang
Know
Main
Plugins
Sandbox
Scm
TWiki  

Schematics


Schematics Home
TWiki Shorthand

Offsite Links


Schemers.org
Lambda the Ultimate
twiki.org
(define dec->roman (lambda (num) (let ((decNums (list 1000 900 500 400 100 90 50 40 10 9 5 4 1)) (romanNums (list "M" "CM" "D" "CD" "C" "XC" "L" "XL" "X" "IX" "V" "IV" "I"))) (dec->Roman-aux num "" decNums romanNums))))

(define dec->roman-aux (lambda(num s decNums romanNums) (if (null? decNums) s (if (>= num (car decNums)) (dec->roman-aux (- num (car decNums)) (string-append s (car romanNums )) decNums romanNums) (dec->roman-aux num s (cdr decNums) (cdr romanNums)) ))))

 
 
© 2004 by the contributing authors. / You are Main.guest