CL-USER> (defun make-counter (n)
(lambda ()
(incf n)))
MAKE-COUNTER
CL-USER> (defparameter c (make-counter 0))
C
CL-USER> (funcall c)
1
CL-USER> (funcall c)
2
CL-USER> (defparameter c2 (make-counter 0))
C2
CL-USER> (funcall c2)
1
(defun direct-product-2arg (lst1 lst2)
(let ((product ()))
(dolist (l1 lst1)
(dolist (l2 lst2)
(setf product (cons
(if (listp l2)
(cons l1 l2)
(list l1 l2)) product))))
(reverse product)))
(defun direct-product (&rest lsts)
(let ((lsts (reverse lsts)))
(nlet iter ((lsts (cdr lsts))
(product (car lsts)))
(if (null lsts)
product
(iter (cdr lsts) (direct-product-2arg (car lsts) product))))))
告知ページを公開しました!
次回は 10/27(土) 13:00-18:00 開催です。
今回のみ 土曜日 開催となりますのでご注意ください。
P.129 「積み木の世界」から読み進めます。
皆様のご参加をお待ちしております。
https://twitter.com/furandon_pig/status/1050008712125894656