Browse thread
[Caml-list] help recursive type
- climb
[
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: | climb <onlyclimb@1...> |
| Subject: | [Caml-list] help recursive type |
Dear caml-list
I want to buidl a tree , so first i defined Node
module Node=
struct
type 'a t = {id : int ; mutable anc : 'a t ; mutable child : 'a t array ;
mutable content : 'a }
let create i init = {id = i ; child = [||] ; content = init ; anc =????}
..
end
i dont know how to define the function var create : int -> 'a -> 'a t
how to initiate anc ?
but if in order to initiate anc easily ,
i define
type 'a t = Empty | Some of { id :int ; mutable anc : 'a t .....}
however syntex error :-(
so, how to solve this problem?
Thanks
Yours
climb
onlyclimb@163.com
2002-12-16
-------------------
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