
6 Jul
2004
6 Jul
'04
9:38 a.m.
Graham Klyne wrote:
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)
Doesn't that need "import Array"?
No, "!" is user defined here (since ghc does not like "#" as infix) btw, now 127: roman=(!5);n!a|n<1=""|n>=t=s!!(a+1):(n-t)!a|c>=t=s!!(2*d):c!a|1>0=n!(a-1)where d=a`div`2;s="ivxlcdm";c=10^d+n;t=5^(d+1)*2^(a-d) Christian