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

Re: [Caml-list] Lambda-Term (f x) (x f) translated to Ocaml?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
 Date: -- (:) From: Oliver Bandel Subject: Re: [Caml-list] Lambda-Term (f x) (x f) translated to Ocaml?
```On Tue, Mar 28, 2006 at 02:44:55AM +0200, yoann padioleau wrote:
>
> > Hello,
> >
> > I'm not firm in lambda calculus, what is the lambda-term
> > in the subject translated to OCaml?
> >
> > Is this possible?
>
> the ocaml interpreter dont want this definition
>
> let g f x = (f x) (x f)

Oh, looks easy....  ( at least the definition on the left side ;-) )

>
> and shout:
>   this expression has type ('a -> 'b) -> 'c -> 'd but is here used with type 'a

OK,
I tried this:

=====================================================================
first:~/Desktop oliver\$ ocaml
Objective Caml version 3.09.0

# let g f x = (f x) (x f) ;;
This expression has type ('a -> 'b) -> 'c -> 'd but is here used with type 'a
# ^D
first:~/Desktop oliver\$ ocaml -rectypes
Objective Caml version 3.09.0

# let g f x = (f x) (x f) ;;
val g : (('a -> 'c as 'b) -> 'c -> 'd as 'a) -> 'b -> 'd = <fun>
#
=====================================================================

Well, looks complicated to me.

Any hints to this?

Ciao,
Oliver

```