Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
* [Caml-list] beta-reduction rules
@ 2003-03-24 13:08 Damien
  2003-03-24 16:06 ` David Monniaux
  0 siblings, 1 reply; 2+ messages in thread
From: Damien @ 2003-03-24 13:08 UTC (permalink / raw)
  To: caml-list

hello,

What are the rules for applying a function to its arguments ?

# let g f i = f i;;
	val g : ('a -> 'b) -> 'a -> 'b = <fun>

# let rec f0 x   = fun i -> (f x) i;;
	val f0 : 'a -> 'b -> 'c = <fun>
# let rec f1 x i = (f1 x) i;;
	val f1 : 'a -> 'b -> 'c = <fun>
# let rec f2 x   = g (f2 x);;
	val f2 : 'a -> 'b -> 'c = <fun>

# let a = f0 ();;
	val a : '_a -> '_b = <fun>
# let a = f1 ();;
	val a : '_a -> '_b = <fun>
# let a = f2 ();;
	Stack overflow during evaluation (looping recursion?).

I expected f0, f1 and f2 to be equivalent,
but,  f0 and f1 look like ['a * 'b->'c)]
and f2  looks like ['a->('b->'c)]

Is it a normal feature ?


damien


<http://www.ens-lyon.fr/~dpous>

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-03-24 16:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-03-24 13:08 [Caml-list] beta-reduction rules Damien
2003-03-24 16:06 ` David Monniaux

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox