2012-01-01から1ヶ月間の記事一覧

例の問題

CLの練習で適当に書いた。いったい何を訴えたいのかよくわからないコードになった。 解き方はいたって普通。 (require :alexandria) (require :cl-ppcre) (defun perms (n xs list fn) (if (zerop n) (funcall fn list) (loop for x in xs do (perms (1- n) …

ccl:*command-line-argument-list* がなんか変

● 実行形式ファイルが作りたい コマンドライン引数リストをそのまま表示するプログラム(Clozure CL) ;;; hello.lisp (defun -main () (format t "~a" ccl:*command-line-argument-list*)) (ccl:save-application "hello" :toplevel-function #'-main :prepen…

partial関数(マクロ)の続き

前回書いた partial マクロ利用例 (mapcar (partial #'args-rotate-right 1 #'make-list :initial-element 'X) '(1 2 3 4 5)) mapcar の第一引数をもう少し理解しやすい形にしたい。 そこで部分適用を段階的にしてみる。args-rotate-right 1 を部分適用した…