-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmacro.lisp
41 lines (30 loc) · 1.33 KB
/
macro.lisp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
(in-package :arc-compat.internal)
(in-readtable :common-lisp)
;; '(w/uniq)
;; Copyright 1995 by Paul Graham.
;; http://lib.store.yahoo.net/lib/paulgraham/onlisp.lisp
;; http://lib.store.yahoo.net/lib/paulgraham/utx.lisp
;; http://lib.store.yahoo.net/lib/paulgraham/acl2.lisp
;;
;; Documentation String
;; http://arcfn.com/doc/
;; Copyright 2008 Ken Shirriff.
;[code] [Foundation] macex macro
(defalias macex cl:macroexpand
"Expands a macro.")
;[code] [Foundation] macex1 macro
(defalias macex1 cl:macroexpand-1
"Expands a macro to one level.")
;; *onlisp*
(defmacro w/uniq (syms &body body)
"Assigns a unique symbol to each name in names and executes body.
names can either be a single symbol or a list of symbols."
`(cl:let ,(mapcar (lambda (s)
`(,s (uniq)))
(if (atom syms) `(,syms) syms))
,@body))
;[code] [Foundation] quasiquote arg
;The backquote ` is shorthand for quasiquote, e.g. `(+ 1 2) is the same as (quasiquote (1 2)). Inside quasiquote, the unquote operator will cause the contents to be evaluated instead of quoated. The unquote-splicing operator will cause contents to be evaluated and spliced into the result. , is shorthand for unquote, and ,@ is shorthand for unquote-splicing.
;[code] [Foundation] quote arg
;The single quote ' is shorthand for quote, e.g. 'x is the same as (quote x)
;<- cl