Comment detail
メソッド名一覧の表示 (Nested Flatten)
変数の定義でもシンボルはインターンされるので fboundp を。ついでに大文字小文字を区別する別回答。
funcall は関数を探しにいきますので symbol-function は不要ですがなんとなく。
1 2 3 4 | (defun call-test (pakcage)
(do-symbols (symbol pakcage)
(when (and (fboundp symbol) (ppcre:scan "^test_" (symbol-name symbol)))
(format t "~A => ~A~%" symbol (funcall (symbol-function symbol))))))
|
ぎゃぁ、fboundpが抜けてたorzorzorz
1 2 3 4 5 6 7 8 9 | (require :cl-ppcre)
(defun test_1 () 1)
(defun test_2 () 2)
(defun test_3 () 3)
(defparameter test_var 0)
(loop for f in (ppcre:regex-apropos-list "^test_" *package*)
when (fboundp f)
collect (cons f (funcall f))) ; => ((TEST_1 . 1) (TEST_3 . 3) (TEST_2 . 2))
|




rubikitch
#1464()
[
Common Lisp
]
Rating0/0=0.00
Rating0/0=0.00-0+
1 reply [ reply ]