Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
10
Task/Roman-numerals-Encode/APL/roman-numerals-encode.apl
Normal file
10
Task/Roman-numerals-Encode/APL/roman-numerals-encode.apl
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
toRoman←{
|
||||
⍝ Digits and corresponding values
|
||||
ds←((⊢≠⊃)⊆⊢)' M CM D CD C XC L XL X IX V IV I'
|
||||
vs←1000, ,100 10 1∘.×9 5 4 1
|
||||
⍝ Input ≤ 0 is invalid
|
||||
⍵≤0:⎕SIGNAL 11
|
||||
{ 0=d←⊃⍸vs≤⍵:⍬ ⍝ Find highest digit in number
|
||||
(d⊃ds),∇⍵-d⊃vs ⍝ While one exists, add it and subtract from number
|
||||
}⍵
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue