This commit is contained in:
Ingy döt Net 2013-04-10 16:57:12 -07:00
parent 518da4a923
commit 764da6cbbb
6144 changed files with 83610 additions and 11 deletions

View file

@ -0,0 +1,8 @@
;; iterate using dolist, destructure manually
(dolist (pair alist)
(destructuring-bind (key . value) pair
(format t "~&Key: ~a, Value: ~a." key value)))
;; iterate and destructure with loop
(loop for (key . value) in alist
do (format t "~&Key: ~a, Value: ~a." key value))

View file

@ -0,0 +1,2 @@
(loop for (key value) on plist :by 'cddr
do (format t "~&Key: ~a, Value: ~a." key value))

View file

@ -0,0 +1,3 @@
(maphash (lambda (key value)
(format t "~&Key: ~a, Value: ~a." key value))
hash-table)

View file

@ -0,0 +1,2 @@
(loop for key being each hash-key of hash-table using (hash-value value)
do (format t "~&Key: ~a, Value: ~a." key value))

View file

@ -0,0 +1,6 @@
(with-hash-table-iterator (next-entry hash-table)
(loop
(multiple-value-bind (nextp key value) (next-entry)
(if (not nextp)
(return)
(format t "~&Key: ~a, Value: ~a." key value)))))