[Haskell-beginners] function defenition. Do I understand it right?
Ozgur Akgun
ozgurakgun at gmail.com
Tue Jul 12 00:17:30 CEST 2011
Hi.
On 11 July 2011 18:44, David McBride <dmcbride at neondsl.com> wrote:
> And your first version (once corrected for syntax) works on any list
> length except for empty lists.
>
Why wouldn't it work for empty lists?
For example with the following definition:
halve xs = let n = length xs `div` 2 in (take n xs, drop n xs)
Best,
Ozgur
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20110712/897ecf1e/attachment.htm>
More information about the Beginners
mailing list