[
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: | -- (:) |
| From: | Damien <Damien.Pous@e...> |
| Subject: | [Caml-list] beta-reduction rules |
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