This site is updated infrequently. For up-to-date information, please visit the new OCaml website at ocaml.org.

[Caml-list] Function call with a list of parameters
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
 Date: 2001-12-12 (18:50) From: Chris Hecker Subject: Re: [Caml-list] Function call with a list of parameters
```
>The usual solution is as follows:
>  # let uncurry g (x,y) = g x y;;
>  val uncurry : ('a -> 'b -> 'c) -> 'a * 'b -> 'c = <fun>
>  # uncurry g (f());;
>  - : int = 3

Sure, but if I have a function that's like this:

let f blah = (x,y)
let g a b x y c d = ...

Then I need to write a new uncurry to pass x y into the right parameters in g.  At which point it's easier to just do the "let x,y = f blah in" construct.

I'm not saying the lack of this feature is a showstopper or anything, but since the other guy brought it up, I figured I'd post about it since it's kind of bothered me for a while.  :)

It does seem like there's an asymmetry in parameters versus return values that might be worth looking into (in languages in general, not just caml).  Bruce's example was interesting to me because I didn't know that lisp had tuples (as opposed to just lists).  That reintroduces the asymmetry that I'm talking about, where if everything was just a list (both returns and params) then it would be symmetric and apply would just work.  Even with tuples, lisp is still more symmetric since you can convert a tuple to a list generically and then pass it in with apply (according to Bruce's example).

I would assume people way more knowledgable than me have analyzed the tradeoffs in the [a]symmetry before.  Assuming it's interesting at all, which I don't know enough about languages to know that either.  :)

Chris

-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr

```