- 755 名前:デフォルトの名無しさん mailto:sage [2008/10/02(木) 22:56:49 ]
- 大量のハッシュの設定が面倒だったので一気に指定できるマクロを作成しました
修正できる所をご教授願います。 (defmacro sethash (table key word) `(setf (gethash ',key ,table) ,word)) (defmacro multiple-sethash (table &rest key-word-lst) `(progn ,@(mapcar #'(lambda (pair) `(sethash ,table ,@pair)) (group key-word-lst 2)))) (defun group (source n) (if (zerop n) (error "zero length")) (labels ((rec (source acc) (let ((rest (nthcdr n source))) (if (consp rest) (rec rest (cons (subseq source 0 n) acc)) (nreverse (cons source acc)))))) (if source (rec source nil) nil)))
|

|