On 3/19/06, Neil Rutland <[EMAIL PROTECTED]> wrote:
>
>
>
> Hi Everyone,
>
> I am completely new to this so my apologies if some of the questions are ill
> described/directed, but if they are just let me know and i'll try and make
> the relevent changes.
>
> I chose this one as it seemed the right sort for me with my (rudimentary
> knowledge), the first question is probably very simple but a bit of a jump
> for my brain.
>
> Basically i want to add two user entered numbers together to calculate the
> number of stops between two traint stations so i think i would define that
> as so:
>
> stops :: int->int->int
>
> I think that says that the function stops takes two integers and returns an
> integer.
>
> What i'm not entirely sure of is how i'd then write the function itself
> because i literally want it to have the following form
>
> stops (x,y) = x+y
>

I think you're looking for:

stops x y = x+y

Or use your own definition and change the type to stops:: (Int,Int) -> Int
It's generally recommended not to send the parameters of your function
as a tuple (like you're doing) but rather "one at a time" like the
example I gave above.

/S


--
Sebastian Sylvan
+46(0)736-818655
UIN: 44640862
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to