Version française
Home     About     Download     Resources     Contact us    
Browse thread
RE: [Caml-list] variant with tuple arg in pattern match?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Dave Berry <Dave@k...>
Subject: RE: [Caml-list] variant with tuple arg in pattern match?
> From: Marcin 'Qrczak' Kowalczyk [mailto:qrczak@knm.org.pl]
> Sent: Tuesday, April 10, 2001 14:12

> It's not a hack. When functions can return functions, there 
> is no need of inventing the concept of multiparameter functions.

>From a theoretical perspective, of course not.  From a programming
perspective, there are several reasons, many of which I gave in my
message.  Others include ease of compilation, and familiarity to
mainstream programmers.

> > In cases where a function is explicitly returning another 
> > (as opposed to
> > just simulating multiple arguments), I think the explicit binding
> > describes what is happening more clearly.
> 
> It's not opposition. This is semantically the same, so there 
> is no need of introducing a syntactic difference.

There are two levels of semantics here.  At the higher level, we have
the behaviour that the programmer is trying to communicate, which
distinguishes returning a function as a result on the one hand from
passing multiple arguments on the other.  The lower level is how this is
encoded in the programming language.  With currying, there is no
difference between the two, so information has been lost.  With multiple
arguments, the distinction is maintained.

> Does map take a function and a list, returning a list, or does it lift
> a function to a function operating on a list? 

Or does it raise a list to a function operating on a function?  Oops,
no, it can't do that, because the person who defined the function didn't
anticipate this use of it.  Time to eta-expand and flip...

Dave.
-------------------
To unsubscribe, mail caml-list-request@inria.fr.  Archives: http://caml.inria.fr