-
Notifications
You must be signed in to change notification settings - Fork 0
/
quote-and-eval.lisp
72 lines (49 loc) · 831 Bytes
/
quote-and-eval.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
(quote (+ 1 2))
;; => (+ 1 2)
(quote nil)
;; => NIL
(quote blah)
;; => BLAH
(eval (quote (+ 1 2)))
;; => 3
(eval (quote blah))
;; ERROR!
(eval 1)
;; => 1
(eval nil)
;; => NIL
(eval T)
;; => T
(eval :blah)
;; => :BLAH
(eval (quote T))
;; => T
(list 1 2 3)
;; => (1 2 3)
(quote (1 2 3))
;; => (1 2 3)
'(1 2 3)
;; => (1 2 3)
(setf my-list (quote (1 2 3)))
;; => (1 2 3)
(car my-list)
;; => 1
(quote foo)
;; => FOO
'foo
;; => FOO
'(foo bar)
;; => (FOO BAR)
'((quote foo) (quote bar))
;; => ('FOO 'BAR)
(list (list 1) (list 2) (list 3))
;; => ((1) (2) (3))
'((1) (2) (3))
;; => ((1) (2) (3))
(list (list (+ 1 1)) (list (+ 2 2)) (list (+ 3 3)))
;; => ((2) (4) (6))
'(((+ 1 1)) ((+ 2 2)) ((+ 3 3)))
;; => (((+ 1 1)) ((+ 2 2)) ((+ 3 3)))
`((,(+ 1 1)) (,(+ 2 2)) (,(+ 3 3)))
;; => ((2) (4) (6) MY-LIST)
(macroexpand)