On Thu, Sep 10, 2009 at 14:43, Peter Verswyvelen wrote:

> On Thu, Sep 10, 2009 at 11:47 AM, Roman Cheplyaka wrote:
> >  step x g a = g (f a x)
> >
> > is, thanks to currying, another way to write
> >
> >  step x g = \a -> g (f a x)
>
> I thought currying just meant
>
> curry f x y = f (x,y)
>
>
> Isn't the reason that
>
> f x y z = body
>
> is the same as
>
> f = \x -> \y -> \z -> body
>
> just cause the former is syntactic sugar of the latter?
>

In some functional programming languages, these are not equivalent. For
example, Clean does not have currying, so

  f :: Int Int -> Int
  f x y = x + y

is not the same as

  f :: Int -> Int -> Int
  f x = (+) x

Notice the difference in types. The first is more like 'f :: (Int, Int) ->
Int' in Haskell.

Sean
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to