partial application
Pixel
pixel@mandrakesoft.com
18 Mar 2002 17:30:34 +0100
Koen Claessen <koen@cs.chalmers.se> writes:
[...]
> ... (\x -> f x 2 3) ...
>
> This seems rather ugly, since the order of arguments in a
> function plays a crucial role. For example, the map function
> takes the list as its second argument, since it is so much
> more common to partially apply map with the function rather
> than the list.
For sure the order of arguments play a crucial role in MLs.
I don't know many other syntax:
- merd http://merd.net/choices_syntax.html#function_calls
f(1, 2, ) is (f 1 2)
f(, 2, 3) is (\x -> f x 2 3)
- OCaml's labels http://caml.inria.fr/ocaml/htmlman/manual006.html
f ~y:2 ~z:3 is (\x -> f x 2 3)
- Pop-11 http://www.cs.bham.ac.uk/research/poplog/primer/node96.html
f(% 2, 3 %) is (\x -> f x 2 3)
I'm interested in other syntaxes...
> For 2-argument functions, the sections notation might help:
>
> (1 `f`) -- === (f 1) === (\y -> f 1 y)
> (`f` 2) -- === (\x -> f x 2)
I never thought of this :)
Of course it also works with more than 2-argument functions when you want to
partially apply only the 2 second argument:
(`f` 2) 1 3
> In a distant past, Erik Meijer and I experimented with
> introducing the syntax:
>
> (f 1 2 _)
> (f 1 _ 3)
> (f _ 2 3)
>
> But it became all very clumsy.
do you have more info on this?