unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* How to copy hash table?
@ 2004-01-23 13:58 Roland Orre
  2004-01-27 15:29 ` Mikael Djurfeldt
  0 siblings, 1 reply; 2+ messages in thread
From: Roland Orre @ 2004-01-23 13:58 UTC (permalink / raw)


In earlier guiles, where hash-tables were vectors, I used copy-tree to
copy a hash table. Now in guile-1.7 copy-tree of the hash-table gives me
the same hash table back, which I assume is correct for atomic objects.

What I want is a table where the handles are copies so when modifying the
values in the new table it won't affect the original.

I guess there exists no trick to generally copy objects.

(Of course, for now, to overcome this I'm using hash-for-each but I'm
 curios about the general issue)

/Roland




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


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

* Re: How to copy hash table?
  2004-01-23 13:58 How to copy hash table? Roland Orre
@ 2004-01-27 15:29 ` Mikael Djurfeldt
  0 siblings, 0 replies; 2+ messages in thread
From: Mikael Djurfeldt @ 2004-01-27 15:29 UTC (permalink / raw)
  Cc: guile-user, djurfeldt

Roland Orre <roland.orre@neurologic.se> writes:

> In earlier guiles, where hash-tables were vectors, I used copy-tree to
> copy a hash table. Now in guile-1.7 copy-tree of the hash-table gives me
> the same hash table back, which I assume is correct for atomic objects.
>
> What I want is a table where the handles are copies so when modifying the
> values in the new table it won't affect the original.
>
> I guess there exists no trick to generally copy objects.
>
> (Of course, for now, to overcome this I'm using hash-for-each but I'm
>  curios about the general issue)

You're right that hash-for-each is currently the best way to do it.

Do people feel that we should have a primitive

  hash-copy

?

M


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


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

end of thread, other threads:[~2004-01-27 15:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-01-23 13:58 How to copy hash table? Roland Orre
2004-01-27 15:29 ` 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).