Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
|
|
@ -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))
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
(loop for (key value) on plist :by 'cddr
|
||||
do (format t "~&Key: ~a, Value: ~a." key value))
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
(maphash (lambda (key value)
|
||||
(format t "~&Key: ~a, Value: ~a." key value))
|
||||
hash-table)
|
||||
|
|
@ -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))
|
||||
|
|
@ -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)))))
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
;; Project : Associative array/Iteration
|
||||
|
||||
(setf x (make-array '(3 2)
|
||||
:initial-contents '(("hello" 13 ) ("world" 31) ("!" 71))))
|
||||
(setf xlen (array-dimensions x))
|
||||
(setf len (car xlen))
|
||||
(dotimes (n len)
|
||||
(terpri)
|
||||
(format t "~a" (aref x n 0))
|
||||
(format t "~a" " : ")
|
||||
(format t "~a" (aref x n 1)))
|
||||
Loading…
Add table
Add a link
Reference in a new issue