Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] type matching
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Flávio Leonardo Cavalcanti de Moura <flavio@m...>
Subject: [Caml-list] type matching
Hi there, 

I am trying to build a normalisation function for lambda terms which
uses the leftmost strategy. Since the function is not working properly,
I decided to try it at the top level. So after loading some cmo and cma
bytecodes I got:

# let beta_normout l_upl = 
  let new_l_upl = ref l_upl in 
  let exp = ref (Common.first(List.hd !new_l_upl)) in 
    while (Common.pos_leftBR !exp <> [3]) do 
      new_l_upl := reduce_pure !exp 1 (Common.pos_leftBR !exp)
!new_l_upl;
      exp := (left_normal_lse !exp (Common.pos_leftBR !exp))
    done; 
    !new_l_upl;;
              val beta_normout :
  (Setypes.exlambda * int * int list * string) list ->
  (Setypes.exlambda * int * int list * string) list = <fun>

Then, when I try to run an example, I get:

# beta_normout [((A(L(DB 1),DB 2)),0,[],"")];;
Characters 14-41:
  beta_normout [((A(L(DB 1),DB 2)),0,[],"")];;
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^
This expression has type exlambda * int * 'a list * string
but is here used with type Setypes.exlambda * int * int list * string

My dout is: shouldn't the type exlambda match with the type
Setypes.exlambda as well as 'a list with int list in the two last line
above?

Why Ocaml differ between the types Setypes.exlambda and exlambda?

I will be very happy if someone could help me.

best regards, 

Flavio.

-------------------
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