I have recently been working with hash tables in Common Lisp. I have been wondering how to make a separate copy of a hash table containing all the same values as the first. Is there an official way to do this? If not, can you give me an example using maphash?
相关问题
- Drakma and Dexador both fails at USocket call whil
- Character.getNumericvalue in char Frequency table
- Can a memory page be moved by modifying the page t
- Why is the table attribute of Hashtable serialized
- Baby-Step Giant Step Algorithm in c#. Hash table o
相关文章
- Does learning one Lisp help in learning the other?
- Common Lisp: Why does my tail-recursive function c
- How do I write a macro-defining macro in common li
- How can I unintern a qualified method?
- using Visual Studio to copy files?
- Changing the nth element of a list
- scala copy objects
- Is a “transparent” macrolet possible?
As clhs does not list a copy table function I'd assume that maphash is the way to go.
This function however does not take special configurations of the hashtable into account, but it should suffice as an example.
Sim's answer copies a hash table, but there are two other features of hash tables taht might be good to copy for efficient population of the table. Here's a version that preserves that information, and also showcases loop's ability to work with hash tables (as an alternative to maphash):
Don't reinvent the wheel, use
copy-hash-table
from Alexandria.