RosettaCodeData/Task/Roman-numerals-Encode/APL/roman-numerals-encode.apl

11 lines
375 B
APL
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

toRoman{
⍝ Digits and corresponding values
ds(())' M CM D CD C XC L XL X IX V IV I'
vs1000, ,100 10 1.×9 5 4 1
⍝ Input ≤ 0 is invalid
0:⎕SIGNAL 11
{ 0=dvs: ⍝ Find highest digit in number
(dds),-dvs ⍝ While one exists, add it and subtract from number
}
}