Browse thread
RE: [Caml-list] variant with tuple arg in pattern match?
-
Dave Berry
- Marcin 'Qrczak' Kowalczyk
- Frank Atanassow
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: | 2001-04-10 (13:51) |
From: | Frank Atanassow <franka@c...> |
Subject: | Re: [Caml-list] variant with tuple arg in pattern match? |
Dave Berry wrote (on 10-04-01 13:17 +0100): > You certainly can avoid currying in functional languages. Currying is a > hack that was created to keep the lambda calculus as simple as possible. When you say "currying" you are talking about a syntactic matter which arises due to positional application. When Daniel said that "currying" is basic to the lambda-calculus, he was talking about a more fundamental, semantic matter. If you look at lambda-calculus from a sufficiently abstract perspective where the syntax is immaterial, then the essential difference between a first-order and higher-order language is that in the second case you can represent a function of two arguments (or a function whose argument is a 2-tuple) as a higher-order function of one argument (and be able to apply it), and vice versa. This characterization says nothing about positional application, labels or what-have-you, because they are only a means of notation. > Daniel points out that you will always be able to return a function from > a function. But currying is a partly syntactic hack; it relies on > function application being notated by juxtaposition. Without this hack, > you have to write: > let f = g (x, y) > f (z) > instead of: > g x y z Whichever way you write it, the same thing is still going on. If your calculus is really equivalent to lambda-calculus, I should be able to transform the first example to: (g (x,y)) (z) which still uses positional application. Otherwise, you are just forcing me to name all my function terms. And how do you define g in the first case if you don't have semantical currying? You need lambda: let g = fun (x, y) -> fun z -> h(x,y,z) In a traditional denotational model, every term t is modeled as a function f from (the product of) its environment to t. To bind a free variable, say z, you need to curry f w.r.t. to z. So you still need currying to define lambda. -- Frank Atanassow, Information & Computing Sciences, Utrecht University Padualaan 14, PO Box 80.089, 3508 TB Utrecht, Netherlands Tel +31 (030) 253-3261 Fax +31 (030) 251-379 ------------------- To unsubscribe, mail caml-list-request@inria.fr. Archives: http://caml.inria.fr