RosettaCodeData/Task/Associative-array-Iteration/Common-Lisp/associative-array-iteration...

9 lines
285 B
Common Lisp

;; 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))