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
Hashtbl: get first n keys
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2007-12-11 (16:38)
From: Fabrice Marchant <fabricemarchant@f...>
Subject: Re: [Caml-list] Hashtbl: get first n keys
> Please, could someone suggest a way to get "n" keys of a hash table? No 
> order nor other restriction about the keys, just "n " keys existing in 
> the table.
> A method based on "iter" and raise and exception when limit is reached 
> seems possible, but could be there are better options.

  Hi !

A particular case - n = 1 - , for a hashSet that lacked a function to exhibit one some element :

However based on the iter / exception you spoke about.

Should be easy to adapt this to your problem.