Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

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 Wed, Apr 21, 2004 at 03:19:04AM +0200, Oliver Bandel wrote:
> I only think, this is such an often used function, that
> it should be integrated into the Hastbl-module.

You may be interested that Missinglib, which I will announce here
shortly, has this in its Hashtblutil module:

let map f hash = Hashtbl.fold (fun key value l -> (f key value) :: l) hash [];;
let keys hash = map (fun key value -> key) hash;;
let values hash = map (fun key value -> value) hash;;
let items hash = map (fun key value -> key, value)  hash;;
let length hash = List.length (keys hash);;

To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: