Another boring variant from me then.<br><br>isHomogeneous xs = all (first==) xs<br> where first = head xs<br><br>Guess what? You do not need the special case for [], because "all _ [] = True" allways. So if the list is empty, it won't even try evaluating "first".<br>
<br>Cheers,<br><br><div class="gmail_quote">On 12 March 2010 14:08, Daniel Fischer <span dir="ltr"><<a href="mailto:daniel.is.fischer@web.de">daniel.is.fischer@web.de</a>></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;">
Am Freitag 12 März 2010 14:41:11 schrieb Daniel Fischer:<br>
<div class="im">><br>
> isHomogeneous :: Eq a => [a] -> Bool<br>
> isHomogeneous [] = True<br>
> isHomogeneous (x:xs) = all (== x) xs<br>
><br>
<br>
</div>Variant, getting rid of the special case for an empty list:<br>
<div class="im"><br>
isHomogeneous :: Eq a => [a] -> Bool<br>
</div>isHomogeneous xs = and (zipWith (==) xs (drop 1 xs))<br>
<div><div></div><div class="h5">_______________________________________________<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>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>Ozgur Akgun<br>