[Haskell-cafe] Re: Roman Numerals and Haskell Syntax abuse

Kent Karlsson kentk at cs.chalmers.se
Tue Jul 6 11:26:14 EDT 2004


> now 134
> roman=(!6);n!a|n<1=""|n>=t=s!!a:(n-t)!a|c>=t=s!!(2*e):c!a|1>0=n!(a-1)where(d,m)=a`divMod`2;e=d+m-1;s="ivxlcdm";c=10^e+n;t=10^d*(1+4*m)


Gosh!

Anyway, you missed the roman symbols for 5000 (U+2181) and
10000 (U+2182)... ;-) The ones for 50000 and 100000 aren't in
Unicode yet, nor is the "canopy" used to write even larger
values (see http://std.dkuug.dk/jtc1/sc2/wg2/docs/n2738).

   /Kent K




More information about the Haskell-Cafe mailing list