From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id 7ED07BB91 for ; Fri, 10 Dec 2004 20:44:41 +0100 (CET) Received: from mail.gmx.net (mail.gmx.net [213.165.64.20]) by concorde.inria.fr (8.13.0/8.13.0) with SMTP id iBAJifcg024378 for ; Fri, 10 Dec 2004 20:44:41 +0100 Received: (qmail 5457 invoked by uid 65534); 10 Dec 2004 19:44:40 -0000 Received: from J3e59.j.pppool.de (EHLO [192.168.2.10]) (85.74.62.89) by mail.gmx.net (mp015) with SMTP; 10 Dec 2004 20:44:40 +0100 X-Authenticated: #20477425 From: Micha To: caml-list@yquem.inria.fr Subject: Re: [Caml-list] How to use Set Datatype Date: Fri, 10 Dec 2004 20:44:39 +0100 User-Agent: KMail/1.7 References: <41B9ECE5.50901@neptun.uni-freiburg.de> In-Reply-To: <41B9ECE5.50901@neptun.uni-freiburg.de> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200412102044.39846.micha-1@fantasymail.de> X-Miltered: at concorde with ID 41B9FCA9.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 datatype:01 ocaml:01 datatype:01 stringset:01 struct:01 stringset:01 cheers:01 10.:98 ...:98 strings:01 string:03 module:03 module:03 let:03 X-Spam-Checker-Version: SpamAssassin 3.0.0 (2004-09-13) on yquem.inria.fr X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.0 X-Spam-Level: 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