Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
Re: [Caml-list] CDK license
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2001-06-06 (13:17)
From: Mark Wotton <mrak@c...>
Subject: Re: [Caml-list] question about modules
Thank you very much for your informative replies. I understand more
clearly now, I think.

I have one more question to do with patternmatching on modules.

Currently, I have this:

module Deque = RealTimeDeque(struct let c = 3 end);;
type 'a deque = 'a Deque.queue

type tree = CompTree of tree deque * tree deque;;

let dcons = Deque.cons;;
let dhead = Deque.head;;
let dtail = Deque.tail;;

let dsnoc = Deque.snoc;;
let dlast = Deque.last;;
let dinit = Deque.init;;


let rec lastTree t acc = 
        match t with 
(*              CompTree(Deque.empty, d2) -> acc *)
                CompTree(d1,d2) ->
                        let newTree = CompTree(dinit d1,
                                               dcons (dhead d1) d2)
                        in lastTree newTree (newTree::acc)

I'd like to match the empty Deque, but this gives me a syntax error when i
uncomment the third line. What should I be doing here?

Apologies for asking so many simple/silly questions. I'm still coming to
grips with Ocaml.


To unsubscribe, mail  Archives: