
7 Jun
2009
7 Jun
'09
10:47 p.m.
Martijn van Steenbergen wrote:
Why not rename mod like so?
(%)=mod rtoa c=10^(205558%ord c%7)%9995
Thanks Martijn. My first Haskell golfing tip. :) I found I had to write it with an extra set of parens to get it to work: rtoa c=(10^(205558%ord c)%7)%9995 Though it wasn't my original intention to play Haskell golf, assuming upper case Roman Numerals, we can now write the whole thing as: (%)=mod romanToInt=foldl1(\t n->t+n-t%n*2).map(\c->(10^(205558%ord c)%7)%9995) Can anyone shorten that further? Thanks, /-\ Need a Holiday? Win a $10,000 Holiday of your choice. Enter now.http://us.lrd.yahoo.com/_ylc=X3oDMTJxN2x2ZmNpBF9zAzIwMjM2MTY2MTMEdG1fZG1lY2g...