Version française
Home     About     Download     Resources     Contact us    
Browse thread
beginner question: DAGs w/ recursive types an encapsulation of a Map
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Justin Corn <justincorn@g...>
Subject: beginner question: DAGs w/ recursive types an encapsulation of a Map
Dear all,

I'm trying to construct a tree (for the Aho-Corasick exact match algorithm)
but I can't quite figure out how to do this.

1) Is it possible to declare a recursive type that would allow for a tree
having an arbitrarily large number of children per node?

I couldn't figure that one out, so I was thinking I could use a Map
collection to represent edges.

2) How do you wrap a Map in an object or record?  In my case the edges
represent single characters, so I started with

#module CharMap = Map.Make(Char);;

but then the top level was not happy with

#type node = { a: int; b: CharMap.t };;

3) If there are preexisting graphical libraries for ocaml, maybe I should
just use those, but after searching a bit I was unable to find any.  Does
someone know where I could find one?

Thanks,
Justin