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

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Sven LUTHER <luther@d...>
Subject: Re: [Caml-list] recursive variants
On Fri, May 11, 2001 at 10:52:51PM -0700, Miles Egan wrote:
> type grammar_element =
>   Word of string
> | Wordlist of Word list
> | Phrase of unit -> Wordlist
> | Phraselist of Phrase list

Err, Phrase and such are not types, but values, you could do somethign like :

type a = 
| Word of string
| Wordlist of a list
| Phrase of (unit ->a)
| Phraselist of a list

or more probably :

type word = string
type wordlist = string list
type phrase = unit -> wordlist
type phraselist = phrase list

and then :

type grammar_element =
| Word of word
| Wordlist of wordlist
| Phrase of phrase
| Phraselist of phraselist

or something such.

beware, non of this is tested, but you should be able to find somethign
working along those lines.

Hope this helps, ...

Friendly,

Sven Luther
-------------------
To unsubscribe, mail caml-list-request@inria.fr.  Archives: http://caml.inria.fr