[Haskell-cafe] what did I do wrong

Corentin Dupont corentin.dupont at gmail.com
Sat May 10 12:05:29 UTC 2014


Hi,
remember that in Haskell argument application is just a space, not using
parenthesis and comma like in some imperative languages.
In Java: myFunc (a, b)
Is equivalent in Haskell to: myfunc a b
so center ((1,2), (3, 4)) is a function applied to only one arguement (a
tuple of tuples)


On Sat, May 10, 2014 at 2:00 PM, Roelof Wobben <r.wobben at home.nl> wrote:

> Mathijs Kwik schreef op 10-5-2014 13:55:
>
>  Roelof Wobben <r.wobben at home.nl> writes:
>>
>>  Hello,
>>>
>>> I have to find the center of 2 points as a assigment for a course on
>>> fpcomplete. This is no homework because I do a self-study.
>>>
>>> So I did  this:
>>>
>>> center (x1,y1) (x2,y2) = ( ((x1+x2)/2),((y1+y2)/2) )
>>> main = print $ center ((1,2), (3, 4))
>>>
>> should be:
>>
>> center (x1,y1) (x2,y2) = ( ((x1+x2)/2),((y1+y2)/2) )
>> main = print $ center (1,2) (3, 4)
>>
>>
>>
> oke,
>
> as I see you changed the main function but I have to make the center
> function work not change the main function.
>
>
> Roelof
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20140510/cc52fef2/attachment.html>


More information about the Haskell-Cafe mailing list