On Wed, 3 Nov 2004 16:03:20 -0300 (CLST), andrew cooke

<

andrew@...> wrote:

>

> Where can I find a clear description of how OCaml executes code. In

> particular, I want to understand when functions with several values are

> evaluated - is the evaluation progressive (during Currying) or is

> evaluation delayed until all arguments are present.

>

> For example, are the following equivalent, always?

>

> let example1 a b x =

> let a' = f1 a in

> let b' = f2 b in

> f3 a' b' x

>

> let example2 a b =

> let a' = f1 a in

> let b' = f2 b in

> fun x -> f3 a' b' x

These two are equivalent. I have a question, however, for the list.

Why does example2, when so explicitly curried as such, have a '_a when

curried?

# let a = example2 1 2;;

val a : '_a -> int * int * '_a = <fun>

I know why example1 does this, I woul dhave thought example2 would not have.

> let example3 x a b =

> let a' = f1 a in

> let b' = f2 b in

> f3 a' b' x

The order you pass the arguments in matters in OCaml, since the

invoker has no names.

example3 1 2 3

binds 1 to x, 2 to a, and 3 to b.

example1 1 2 3

binds 1 to a, 2 to b, and 3 to x.

> Thanks,

> Andrew

>

> --

> ` __ _ __ ___ ___| |_____ work web site:

> http://www.ctio.noao.edu/~andrew

> / _` / _/ _ \/ _ \ / / -_) personal web site: http://www.acooke.org/andrew

> \__,_\__\___/\___/_\_\___| list: http://www.acooke.org/andrew/compute.html

>

>

>

> Archives up to September 30, 2004 are also downloadable at

> http://www.connettivo.net/cntprojects/ocaml_beginners/

> The archives of the very official ocaml list (the seniors' one) can be

> found at http://caml.inria.fr

> Attachments are banned and you're asked to be polite, avoid flames etc.

>

>

>

> Yahoo! Groups Sponsor

>

> ADVERTISEMENT

>

>

> ________________________________

> Yahoo! Groups Links

>

> To visit your group on the web, go to:

> http://groups.yahoo.com/group/ocaml_beginners/

>

> To unsubscribe from this group, send an email to:

> ocaml_beginners-unsubscribe@yahoogroups.com

>

> Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.

--

Seth Fogarty sfogarty@[gmail.com|rice.edu|livejournal]

Neep-neep at large AIM: Sorrath

"I know there are people in this world who do not love their fellow

human beings - and I hate people like that" --Tom Lehrer.