Thanks Felipe Lessa for shortening the code :) and everyone for advice. <br><br>I have recently started learning haskell from the book <br>Learnyouahaskell - <a href="http://www.learnyouahaskell.com">www.learnyouahaskell.com</a> - I am done with the book except for Bytestreams and randomness. Was trying to put my haskell skills to use on the problems of this kind. My aim is to understand and practice haskell and not WIN these code golf competitions! . So, please suggest me what are the other books i can read ( and work through :) ), in general any good open source projects to involve in, etc.. basically any advices to improve as a haskell programmer.<br>

<br>Thanks in advance.<br><br><br><div class="gmail_quote">On Wed, Jun 30, 2010 at 9:50 AM, Lyndon Maydwell <span dir="ltr">&lt;<a href="mailto:maydwell@gmail.com">maydwell@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">

I agree. If you&#39;re aiming for really terse code, have a look at the<br>
J/K languages. These seem to win most golf-shootout type competitions.<br>
Haskell is more focused on expressiveness and abstraction.<br>
<div><div></div><div class="h5"><br>
On Wed, Jun 30, 2010 at 11:25 AM, Michael Mossey &lt;<a href="mailto:mpm@alumni.caltech.edu">mpm@alumni.caltech.edu</a>&gt; wrote:<br>
&gt;<br>
&gt;<br>
&gt; rizwan hudda wrote:<br>
&gt;&gt;<br>
&gt;&gt; I have recently started learning haskell, and was trying to write a code<br>
&gt;&gt; for this problem <a href="http://www.spoj.pl/problems/KAMIL" target="_blank">http://www.spoj.pl/problems/KAMIL</a> in haskell. The aim is to<br>
&gt;&gt; write a shortest possible code for the given task. I have previously solved<br>
&gt;&gt; this in c,c++,perl,python.My best was 57 characters using perl. So here&#39;s my<br>
&gt;&gt; code in HASKELL:<br>
&gt;&gt;<br>
&gt;&gt; main = interact $ unlines. map (show.foldl (\a x-&gt; if null $ filter (==x)<br>
&gt;&gt; &quot;TDLF&quot; then a else a+a) 1) .lines<br>
&gt;&gt;<br>
&gt;&gt; It is 107 characters [ non white space and newline ]. I was interested in<br>
&gt;&gt; knowing how i could further optimize the size of this code.<br>
&gt;<br>
&gt; This kind of contest is fun, but I can&#39;t help thinking I hope you are<br>
&gt; learning Haskell to appreciate the things that functional programming is<br>
&gt; good at. Real-world Haskell is often more concise than other languages<br>
&gt; because Haskell has mechanisms for eliminating unnecessary and redundant<br>
&gt; code, but Haskell&#39;s strength is not winning &quot;shortest program&quot; contests.<br>
&gt;<br>
&gt; Mike<br>
</div></div><div><div></div><div class="h5">&gt; _______________________________________________<br>
&gt; Beginners mailing list<br>
&gt; <a href="mailto:Beginners@haskell.org">Beginners@haskell.org</a><br>
&gt; <a href="http://www.haskell.org/mailman/listinfo/beginners" target="_blank">http://www.haskell.org/mailman/listinfo/beginners</a><br>
&gt;<br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>Thanks and regards<br>Rizwan A Hudda<br><a href="http://sites.google.com/site/rizwanhudda">http://sites.google.com/site/rizwanhudda</a><br><br><br><br>