Task

Create a function taking a positive integer as its parameter and returning a string containing the Roman numeral representation of that integer. Modern Roman numerals are written by expressing each digit separately, starting with the left most digit and skipping any digit with a value of zero.



In Roman numerals:

 1990 is rendered: 1000=M, 900=CM, 90=XC; resulting in MCMXC
 2008 is written as 2000=MM, 8=VIII; or MMVIII
 1666 uses each Roman symbol in descending order: MDCLXVI


  [ $ "" 
    swap 1000 /mod $ "M" rot of rot swap join swap
    dup   900 < not if [ 900 - dip [ $ "CM" join ] ]
    dup   500 < not if [ 500 - dip [ $  "D" join ] ]
    dup   400 < not if [ 400 - dip [ $ "CD" join ] ]
          100 /mod $ "C" rot of rot swap join swap
    dup    90 < not if [  90 - dip [ $ "XC" join ] ]
    dup    50 < not if [  50 - dip [ $  "L" join ] ]
    dup    40 < not if [  40 - dip [ $ "XL" join ] ]
           10 /mod $ "X" rot of rot swap join swap
    dup     9 < not if [   9 - dip [ $ "IX" join ] ]
    dup     5 < not if [   5 - dip [ $  "V" join ] ]
    dup     4 < not if [   4 - dip [ $ "IV" join ] ]
    $ "I" swap of join ] 
                              is ->roman ( n --> $ )
 
  1990 dup echo say " = " ->roman echo$ cr
  2008 dup echo say " = " ->roman echo$ cr
  1666 dup echo say " = " ->roman echo$ cr