Should it? I tried to explain it, but if you are not convinced just give it a try.<br><br><br>
&gt;<br>
&gt; Guess what? You do not need the special case for [], because &quot;all _ [] =<br>
&gt; True&quot; allways. So if the list is empty, it won&#39;t even try evaluating<br>
&gt; &quot;first&quot;.<br>
&gt;<br><br><div class="gmail_quote">On 12 March 2010 14:25, Salil Wadnerkar <span dir="ltr">&lt;<a href="mailto:rohshall@gmail.com">rohshall@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="im">On Fri, Mar 12, 2010 at 10:21 PM, Ozgur Akgun &lt;<a href="mailto:ozgurakgun@gmail.com">ozgurakgun@gmail.com</a>&gt; wrote:<br>
&gt; Another boring variant from me then.<br>
&gt;<br>
&gt; isHomogeneous xs = all (first==) xs<br>
&gt;     where first = head xs<br>
<br>
<br>
</div>Shouldn&#39;t<br>
head xs<br>
give an exception on an empty list?<br>
<div><div></div><div class="h5"><br>
<br>
<br>
&gt;<br>
&gt; Guess what? You do not need the special case for [], because &quot;all _ [] =<br>
&gt; True&quot; allways. So if the list is empty, it won&#39;t even try evaluating<br>
&gt; &quot;first&quot;.<br>
&gt;<br>
&gt; Cheers,<br>
&gt;<br>
&gt; On 12 March 2010 14:08, Daniel Fischer &lt;<a href="mailto:daniel.is.fischer@web.de">daniel.is.fischer@web.de</a>&gt; wrote:<br>
&gt;&gt;<br>
&gt;&gt; Am Freitag 12 März 2010 14:41:11 schrieb Daniel Fischer:<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; isHomogeneous :: Eq a =&gt; [a] -&gt; Bool<br>
&gt;&gt; &gt; isHomogeneous [] = True<br>
&gt;&gt; &gt; isHomogeneous (x:xs) = all (== x) xs<br>
&gt;&gt; &gt;<br>
&gt;&gt;<br>
&gt;&gt; Variant, getting rid of the special case for an empty list:<br>
&gt;&gt;<br>
&gt;&gt; isHomogeneous :: Eq a =&gt; [a] -&gt; Bool<br>
&gt;&gt; isHomogeneous xs = and (zipWith (==) xs (drop 1 xs))<br>
&gt;&gt; _______________________________________________<br>
&gt;&gt; Beginners mailing list<br>
&gt;&gt; <a href="mailto:Beginners@haskell.org">Beginners@haskell.org</a><br>
&gt;&gt; <a href="http://www.haskell.org/mailman/listinfo/beginners" target="_blank">http://www.haskell.org/mailman/listinfo/beginners</a><br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; --<br>
&gt; Ozgur Akgun<br>
&gt;<br>
&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>
&gt;<br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>Ozgur Akgun<br>