make "patterns [[?] [? ?] [? ? ?] [? ?2] [?2] [?2 ?] [?2 ? ?] [?2 ? ? ?] [? ?3]] to digit :d :numerals if :d = 0 [output "||] output apply (sentence "\( "word (item :d :patterns) "\)) :numerals end to digits :n :numerals output word ifelse :n < 10 ["||] [digits int :n/10 bf bf :numerals] ~ digit modulo :n 10 :numerals end to roman :n if or :n < 0 :n >= 4000 [output [EX MODVS!]] output digits :n [I V X L C D M] end print roman 1999 ; MCMXCIX print roman 25 ; XXV print roman 944 ; CMXLIV