Skip to content

Commit 2cb80e3

Browse files
brandflake11vindarel
authored andcommitted
Added (clrhash) to data-structures.md
1 parent 36b45c6 commit 2cb80e3

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

data-structures.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -986,6 +986,34 @@ NIL
986986
~~~
987987

988988

989+
<a name="del-tab"></a>
990+
991+
### Deleting a Hash Table
992+
993+
Use
994+
[`clrhash`](http://www.lispworks.com/documentation/HyperSpec/Body/f_clrhas.htm)
995+
to delete a hash table. This will remove all of the data from the hash table and return the deleted table.
996+
997+
~~~lisp
998+
CL-USER> (defparameter *my-hash* (make-hash-table))
999+
*MY-HASH*
1000+
CL-USER> (setf (gethash 'first-key *my-hash*) 'one)
1001+
ONE
1002+
CL-USER> (setf (gethash 'second-key *my-hash*) 'two)
1003+
TWO
1004+
CL-USER> *my-hash*
1005+
#<hash-table :TEST eql :COUNT 2 {10097BF4E3}>
1006+
CL-USER> (clrhash *my-hash*)
1007+
#<hash-table :TEST eql :COUNT 0 {10097BF4E3}>
1008+
CL-USER> (gethash 'first-key *my-hash*)
1009+
NIL
1010+
NIL
1011+
CL-USER> (gethash 'second-key *my-hash*)
1012+
NIL
1013+
NIL
1014+
~~~
1015+
1016+
9891017
<a name="traverse"></a>
9901018

9911019
### Traversing a Hash Table

0 commit comments

Comments
 (0)