Loading ...
Sorry, an error occurred while loading the content.

11159Re: Module parameterization by ints

Expand Messages
  • Vincent Aravantinos
    Jul 1, 2009
    • 0 Attachment
      --- In ocaml_beginners@yahoogroups.com, Phil Tomson <rubyfan@...> wrote:
      > Following up on this question: I need to do something very similar to
      > the original poster's question but the answer given isn't quite clear
      > to me.
      >
      > I would like to create a FIFO that is limited to N slots. I'd like to
      > create a FIFO module that can be parameterized by an integer (N) so
      > that I can create a FIFO of a specific size. How would I go about
      > doing this?

      Good starting points:
      - if you accept an imperative FIFO : module Queue of the standard library
      - if you want a functional FIFO : module Fqueue of Jane Street's Core library (http://ocaml.janestreet.com/?q=node/13, also available with Godi)
      - finally module Squeue of Jane Street's Core library seems to do kinda what you want

      This last module's signature contains the following:

      (** [create maxsize] returns a synchronized queue bounded to have no more than
      [maxsize] elements. *)
      val create : int -> 'a t

      Then you can apply the previous answers (but maybe it is this last point which is the problem ?).

      Cheers
    • Show all 8 messages in this topic