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

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: ronniec95@l...
Subject: [Caml-list] Queue example
Hi,

I'm just trying to figure out how to create a queue of a specific type in
a .ml file. I can do it in the interpreter as:

>let q = Queue.create()
>Queue.add 1 q 

This creates an int queue.

Declaring this in a .ml file gives 

The type of this expression, '_a Queue.t,
contains type variables that cannot be generalized


I know you can construct a Queue and put an item in it straight away to
specify the type, but I want an empty queue to start with; eg like std::queue<int>
from c++.

Any help appreciated.

Thanks.

-------------------
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