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

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.


To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: