unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* About hash-table iterators
@ 2004-01-24 13:19 Roland Orre
  2004-01-27 16:07 ` Mikael Djurfeldt
  0 siblings, 1 reply; 4+ messages in thread
From: Roland Orre @ 2004-01-24 13:19 UTC (permalink / raw)


The elements of a hash table I consider the handles, not the key and
the value as separate entities, therefore I don't consider the current
iterators hash-map and hash-for-each in guile 1.7 very useful and the
basic iterators I've used over the year, i.e iterating over the handles,
can not be constructed from them. To be able to implement my previous
functionality I had to copy and modify a few routines from hashtab.c to
be able to implement e.g

hash-for-each-handle
hash-map-handles
and from the latter can then e.g hash-table->list be implemented

(define-public (hash-table->list htable)  (hash-map-handles id htable))

and when you don't want to be able to modify the original table you can
use hash-map instead:
(define-public (hash-table-copy->list htable)  (hash-map cons htable))

Is this a general interest? In that case these maybe they should be
considered the basic iterators provided instead of hash-for-each and
hash-map as the latter can be implemented from the other but not vice
versa?

	Best regards
	Roland




_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-user


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2004-02-13 23:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-01-24 13:19 About hash-table iterators Roland Orre
2004-01-27 16:07 ` Mikael Djurfeldt
2004-01-27 17:39   ` Roland Orre
2004-02-13 23:22   ` Mikael Djurfeldt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).