[Haskell-beginners] shortening code
rizwanhudda at gmail.com
Tue Jun 29 19:35:11 EDT 2010
I have recently started learning haskell, and was trying to write a code for
this problem http://www.spoj.pl/problems/KAMIL in haskell. The aim is to
write a shortest possible code for the given task. I have previously solved
this in c,c++,perl,python.My best was 57 characters using perl. So here's my
code in HASKELL:
main = interact $ unlines. map (show.foldl (\a x-> if null $ filter (==x)
"TDLF" then a else a+a) 1) .lines
It is 107 characters [ non white space and newline ]. I was interested in
knowing how i could further optimize the size of this code.
Thanks in advance.
Thanks and regards
Rizwan A Hudda
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Beginners