From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id LAA11478; Sun, 2 May 2004 11:12:51 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id LAA11587 for ; Sun, 2 May 2004 11:12:50 +0200 (MET DST) Received: from ptb-relay01.plus.net (ptb-relay01.plus.net [212.159.14.212]) by nez-perce.inria.fr (8.12.10/8.12.10) with ESMTP id i429CnEV009677 for ; Sun, 2 May 2004 11:12:50 +0200 Received: from [80.229.56.224] (helo=chetara) by ptb-relay01.plus.net with esmtp (Exim) id 1BKD1l-0008Do-Fe for caml-list@inria.fr; Sun, 02 May 2004 09:12:49 +0000 From: Jon Harrop Organization: University of Cambridge To: Subject: [Caml-list] Functors Date: Sun, 2 May 2004 10:12:28 +0100 User-Agent: KMail/1.5.4 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200405021012.28011.jdh30@cam.ac.uk> X-Miltered: at nez-perce with ID 4094BB91.001 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; functors:01 implemented:01 checker:01 functor:01 functor:01 functors:01 modules:02 enforce:02 enforce:02 partially:02 comparison:02 comparison:02 argument:03 merged:04 efficient:05 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Could Set (and others) be implemented polymorphically by using a comparison function passed as an argument? If so, what would be the implications of this approach? I think: you couldn't use the type checker to enforce consistent comparison functions between two different sets which were, say, being merged. I think you can enforce this using the functor approach provided the Sets came from the same functor "instantiation". Functors appear to be somewhat similar to templates in C++. Does the functor approach produce more efficient code as it is partially specialised over the comparison function? Also, can functors map to functors as well as modules? If so, code could be progressively specialised... Cheers, Jon. ------------------- 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