[Haskell-beginners] function defenition. Do I understand it right?
Jack Henahan
jhenahan at uvm.edu
Tue Jul 12 01:38:00 CEST 2011
Codepad uses Hugs, according to their about page. Makes me terribly glad that the error messages in GHC are so much more informative.
On Jul 11, 2011, at 7:11 PM, David McBride wrote:
> Because I tried it and it didn't work. But it turns out it does work
> and it was just an ambiguous variable error from using empty list.
> Codepad had a weird error, they must be using an old version of ghc or
> something.
>
> On Mon, Jul 11, 2011 at 6:17 PM, Ozgur Akgun <ozgurakgun at gmail.com> wrote:
>> 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
>>
>
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://www.haskell.org/mailman/listinfo/beginners
More information about the Beginners
mailing list