Last active
December 17, 2015 18:29
-
-
Save stibear/5653118 to your computer and use it in GitHub Desktop.
Common Lisp 理解度チェーック 各出力を頭で考えた後に実行して答え合わせしてみてね!
参考:https://gist.github.com/anonymous/5652948
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;; Q.1 | |
(defun hoge () (print "hoge")) | |
(compile 'hoge) | |
(print (compiled-function-p 'hoge)) | |
;;; Q.2 | |
(defun |@| (&rest rest) | |
(if (nth 3 rest) | |
(format (car rest) "~a~&" (cadr rest)))) | |
(format t "~{~@/@/~^~&~}" '(1 2 3 4)) | |
;;; Q.3 | |
(defvar value 100) | |
(defun print-value () | |
(print value)) | |
(progn (print-value) | |
(let (value) | |
(print-value))) | |
;;; Q.4 | |
(print (let ((let '`(let ((let ',let)) | |
,let))) | |
`(let ((let ',let)) ,let))) | |
;;; Q.5 | |
(defmacro for ((var start stop) &body body) | |
`(do ((,var ,start (1+ ,var)) | |
(limit ,stop)) | |
((> ,var limit)) | |
,@body)) | |
(let ((limit 0)) | |
(for (x 1 10) | |
(print limit))) |
この「test.lisp」を書いている人は力尽きてしまいました。 あとは適当に頑張ってください。
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ネタ尽きた