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
(defun get-my-value () | |
(list val)) | |
(defun my-value () | |
(let ((val nil)) | |
(locally | |
(declare (special val)) | |
(setf val t) | |
(get-my-value)))) |
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
(defun emit-defreplace (name newname) | |
(let ((form | |
'(defmacro name (&body body) | |
`(newname ,@body)))) | |
(setf (cadr form) name) | |
(setf (car (cadr (cadddr form))) newname) | |
form)) |
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
(defun parse-file (file-stream) | |
(let (locations forms) | |
(do ((form (read file-stream nil :eof ) | |
(read file-stream nil :eof ))) | |
((eq form :eof) | |
forms) | |
(push (list :form form | |
:end-position (file-position file-stream)) | |
forms)))) |
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
https://github.com/earl-ducaine/flavor | |
SLIME debug window | |
------------------ | |
COMPILE-FILE-ERROR while | |
compiling #<CL-SOURCE-FILE "flavor" "flavor-main0"> | |
[Condition of type UIOP/LISP-BUILD:COMPILE-FILE-ERROR] |
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
;; A macro that would transform this: | |
(my-macro my-function (medium pathname options) | |
(list medium pathname options)) | |
;; Into: | |
(defun my-function (&rest rest) | |
(let ((medium (nth 0 rest)) | |
(pathname (nth 1 rest)) | |
(options (nth 1 rest))) | |
(list medium pathname options))) |
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
(defmacro valid-address? (address) | |
`(and (numberp ,address) (>= ,address 0) (<= ,address 65535))) |
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
(defclass plane (moving-object graphics-object) | |
((altitude :initform 0 :accessor plane-altitude) | |
(speed)) | |
(:default-initargs :engine *jet*)) | |
(ensure-class 'plane | |
':direct-superclasses '(moving-object graphics-object) | |
':direct-slots (list (list ':name 'altitude | |
':initform '0 | |
':initfunction #'(lambda () 0) |
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
(defun main () | |
(format t "Hello, world!~%")) | |
(sb-ext:save-lisp-and-die "hello-world.exe" | |
:executable t | |
:compression 9 | |
:toplevel 'main) | |
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
CL-USER> *gensym-counter* | |
78744 | |
CL-USER> (gensym "T") | |
#:T78744 | |
CL-USER> *gensym-counter* | |
78745 |
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
(defmacro with-foreign-slots ((vars ptr type) &body body) | |
"Create local symbol macros for each var in VARS to reference | |
foreign slots in PTR of TYPE. Similar to WITH-SLOTS. | |
Each var can be of the form: slot-name - in which case slot-name will | |
be bound to the value of the slot or: (:pointer slot-name) - in which | |
case slot-name will be bound to the pointer to that slot." | |
(let ((ptr-var (gensym "PTR"))) | |
`(let ((,ptr-var ,ptr)) | |
(symbol-macrolet | |
,(loop :for var :in vars |
NewerOlder