From: Micha <micha-1@fantasymail.de>
To: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] How to use Set Datatype
Date: Fri, 10 Dec 2004 20:44:39 +0100 [thread overview]
Message-ID: <200412102044.39846.micha-1@fantasymail.de> (raw)
In-Reply-To: <41B9ECE5.50901@neptun.uni-freiburg.de>
Am Freitag, 10. Dezember 2004 19:37 schrieb Jan Stamer:
> Hi all,
>
> I am new to Ocaml and for the past hour I tried to figure out how to use
> the built-in Set Datatype.
:-) easy to spend time with this ...
> I would like to use a set of Strings. Can anybody help me and give me a
> few lines of sample code?
you have to make a module first, which holds the type and the order function
for your set:
module StringSet = Set.Make (struct type t = string let compare = compare
end);;
now you can use it (silly example :-)
let set_example str =
let set = StringSet.empty in (* make new set *)
let set = StringSet.add set str in
StringSet.mem set "xxx";;
cheers
Michael
next prev parent reply other threads:[~2004-12-10 19:44 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-12-10 18:37 Jan Stamer
2004-12-10 19:44 ` Micha [this message]
2004-12-11 1:33 ` [Caml-list] " Jon Harrop
2004-12-11 21:12 ` Brian Hurt
2004-12-12 0:05 ` skaller
2004-12-12 2:46 ` William Lovas
2004-12-12 3:09 ` Brian Hurt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200412102044.39846.micha-1@fantasymail.de \
--to=micha-1@fantasymail.de \
--cc=caml-list@yquem.inria.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox