Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Should be INSIDE STANDARD-LIB: Hashtbl.keys
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: John Goerzen <jgoerzen@c...>
Subject: Re: [Caml-list] Should be INSIDE STANDARD-LIB: Hashtbl.keys
On Fri, Apr 23, 2004 at 09:07:10PM +0200, Oliver Bandel wrote:
> On Fri, Apr 23, 2004 at 01:29:35PM -0500, John Goerzen wrote:
> > On Fri, Apr 23, 2004 at 06:04:07PM +0200, Xavier Leroy wrote:
> > > repetition" is often not the best data structure for the job.
> > 
> > And a keys function need not necessarily avoid repetition anyway.
> > 
> [...]
> 
> It ONLY makes sense to have a keys function that avoids repitition!

I don't buy that.

> Anything else can be done with List.iter and List.fold
> from the outside of the Hashtbl-module implementation!

And that doesn't mean that having the function is useless.

Hell, Array.sub can be done entirely from pure OCaml.  Ditto for
String.sub.  That doesn't mean that having it in the standard library is
useless.

It's a lot easier to read code that says "keys hash" than a fold
incarnation.  Not to mention being easier to write, maintain, and learn.

-- John

-------------------
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