Sort then ...<div><br><br><div class="gmail_quote">On Tue, Mar 27, 2012 at 7:03 PM, Ramesh Kumar <span dir="ltr">&lt;<a href="mailto:rameshkumar.techdynamics@ymail.com">rameshkumar.techdynamics@ymail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div style="font-size:10pt;font-family:arial,helvetica,sans-serif"><div>Hi,</div><div><br></div><div>I&#39;ve just started learning Haskell a couple of weeks ago using Simon Thompson&#39;s &quot;Haskell: Craft of Functional Programming&quot;.</div>
<div>There is an exercise in chapter 7 of the book which goes something like this:</div><div><br></div><div>Define a function of the type:     unique :: [Integer] -&gt; [Integer]</div><div>which if given a list of integers, should return a list of those integers which occur only once in the input list.</div>
<div>Example:</div><div>   unique [5,2,4,2,3,1,5,2] should result in [4,3,1]</div><div><br></div><div><br></div><div>*** The questions assumes we know only of list comprehensions and recursion. <br></div><div><br></div><div>
I am guessing the solution must include something like this:</div><div><br></div><div>unique :: [Integer] -&gt;
 [Integer]</div><div>unique xs = [ x | x &lt;- xs, isSingle x ]</div><div><br></div><div>My problem is in defining the function &#39;isSingle&#39;.</div><div><br></div><div>I would greatly appreciate any pointers on this.</div>
<div><br></div><div>Many thanks.</div><span class="HOEnZb"><font color="#888888"><div>Ramesh<br></div><div><br></div><div><br></div></font></span></div></div><br>_______________________________________________<br>
Beginners mailing list<br>
<a href="mailto:Beginners@haskell.org">Beginners@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/beginners" target="_blank">http://www.haskell.org/mailman/listinfo/beginners</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br>--<br>Regards,<br>KC<br>
</div>