[Haskell-beginners] Shorten this code

Nadav Chernin nadavchernin at gmail.com
Tue Jul 23 12:41:32 CEST 2013


Hi, all
Below is my solution to SPOJ->Polybius
square<http://www.spoj.com/problems/POLYBIUS>

Please try to shorten it:

*import Data.Maybe*
*d=[1..5]*
*f s=unwords$map(\c->fromJust$lookup c(('
',""):('J',"24"):zip(['A'..'I']++['K'..'Z'])[show(x+10*y)|y<-d,x<-d]))s*
*main=getLine>>(interact$unlines.map f.lines)*



Thanks, Nadav
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20130723/ddffe711/attachment.htm>


More information about the Beginners mailing list