caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] help recursive type
@ 2002-12-16 15:48 climb
  0 siblings, 0 replies; 2+ messages in thread
From: climb @ 2002-12-16 15:48 UTC (permalink / raw)
  To: caml-list

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


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

* [Caml-list] help recursive type
@ 2002-12-16 12:55 climb
  0 siblings, 0 replies; 2+ messages in thread
From: climb @ 2002-12-16 12:55 UTC (permalink / raw)
  To: caml-list

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


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

end of thread, other threads:[~2002-12-17  8:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-12-16 15:48 [Caml-list] help recursive type climb
  -- strict thread matches above, loose matches on Subject: below --
2002-12-16 12:55 climb

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).