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 OAA03008; Sun, 4 May 2003 14:48:44 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id OAA03382 for ; Sun, 4 May 2003 14:48:42 +0200 (MET DST) Received: from eposta.kablonet.com.tr ([62.248.102.66]) by concorde.inria.fr (8.11.1/8.11.1) with SMTP id h44CmdH18117 for ; Sun, 4 May 2003 14:48:40 +0200 (MET DST) Received: (qmail 73703 invoked by uid 0); 4 May 2003 12:56:07 -0000 Received: from unknown (HELO 195.174.169.185) (exa@kablonet.com.tr@195.174.169.185) by 0 with SMTP; 4 May 2003 12:56:07 -0000 From: Eray Ozkural Reply-To: erayo@cs.bilkent.edu.tr Organization: Bilkent University CS Dept. To: "Mattias Waldau" , Subject: Re: [Caml-list] Two types of efficiency (Was Efficiency of 'a list) Date: Sun, 4 May 2003 15:48:09 +0300 User-Agent: KMail/1.5.9 Cc: "'caml Mailing List''" References: <041d01c31208$f02327e0$0200a8c0@gateway> In-Reply-To: <041d01c31208$f02327e0$0200a8c0@gateway> MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <200305041548.09171.exa@kablonet.com.tr> X-Spam: no; 0.00; eray:01 ozkural:01 caml-list:01 mattias:01 waldau:01 beginners:01 overkill:01 hashing:01 kde:01 lousy:01 erayo:01 bilkent:01 ankara:01 malfunction:01 ariza:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Sunday 04 May 2003 09:46, Mattias Waldau wrote: > It would be nice if the typechecker could deduce the type of the set and > add the above declaration automatically to the program. That would make > it easier for beginners to use the advanced datastructures of Ocaml. Nice in theory but doesn't really alleviate the problem. Why? Because a novice can always shoot himself in the foot. Overuse of any datastructure is overkill. If I use the cumbersome R-B trees everywhere, it will not guarantee my program to be efficient. Somebody who doesn't understand asymptotic complexity will use things like a map from strings to strings. You almost never use strings as keys in a tree. You use tries or trie hashing, etc. In KDE source code, for instance, I've seen a lot of instances of such lousy data structures... Just to point out that there is no such thing as the ultimate index structure that works with any kind of key and any kind of records. Therefore attaching syntactic significance to one particular data structure might be highly confusing for programmers. I don't recommend it. What I would recommend would be a more abstract way of doing the same thing. let A = { 3, 5, 7 } It does look like such a statement has its merits! But yet, one must explicitly state what kind of a data structure he really wants somehow. Maybe let A = { 3, 5, 7 } : MyCuteSet BTW, a really abstract set data type does *not* assume a total ordering among elements. That's because I might want to implement multi-sets as unordered lists! Those kinds of things depend on the application. I really don't know how one would solve this in a static syntaxed language! Cheers, -- Eray Ozkural (exa) Comp. Sci. Dept., Bilkent University, Ankara KDE Project: http://www.kde.org www: http://www.cs.bilkent.edu.tr/~erayo Malfunction: http://mp3.com/ariza GPG public key fingerprint: 360C 852F 88B0 A745 F31B EA0F 7C07 AE16 874D 539C ------------------- 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