swissChili | 923b536 | 2021-05-09 20:31:43 -0700 | [diff] [blame] | 1 | (defun add-two (a) |
2 | (+ a 2)) | ||||
swissChili | a820dea | 2021-05-09 16:46:55 -0700 | [diff] [blame] | 3 | |
swissChili | e9fec8b | 2021-06-22 13:59:33 -0700 | [diff] [blame] | 4 | (defun calls-gc (whatever) |
5 | (print whatever) | ||||
6 | (gc)) | ||||
swissChili | 67bdf28 | 2021-06-06 18:46:08 -0700 | [diff] [blame] | 7 | |
swissChili | 2999dd1 | 2021-07-02 14:19:53 -0700 | [diff] [blame] | 8 | (defmacro weird-identity (a) |
9 | a) | ||||
10 | |||||
11 | (defmacro weird-const (a b) | ||||
12 | a) | ||||
13 | |||||
swissChili | 6d6525e | 2021-06-15 21:20:53 -0700 | [diff] [blame] | 14 | (defun main () |
swissChili | e9fec8b | 2021-06-22 13:59:33 -0700 | [diff] [blame] | 15 | (let1 (a (add-two 3)) |
swissChili | 67bdf28 | 2021-06-06 18:46:08 -0700 | [diff] [blame] | 16 | (print "a is") |
swissChili | 2999dd1 | 2021-07-02 14:19:53 -0700 | [diff] [blame] | 17 | (print (weird-identity a)) |
18 | (print (weird-const a 4))) | ||||
swissChili | b8fd471 | 2021-06-23 15:32:04 -0700 | [diff] [blame] | 19 | |
20 | ; These allocations should be freed | ||||
swissChili | 6b47b6d | 2021-06-30 22:08:55 -0700 | [diff] [blame] | 21 | (list 12 34 56) |
22 | (list "a" "b" "c" "d") | ||||
swissChili | e9fec8b | 2021-06-22 13:59:33 -0700 | [diff] [blame] | 23 | |
swissChili | b8fd471 | 2021-06-23 15:32:04 -0700 | [diff] [blame] | 24 | ; But these should not |
swissChili | e9fec8b | 2021-06-22 13:59:33 -0700 | [diff] [blame] | 25 | (let1 (unused-but-bound (cons 5 6)) |
swissChili | 6b47b6d | 2021-06-30 22:08:55 -0700 | [diff] [blame] | 26 | (let1 (val '(a b c d e)) |
swissChili | e9fec8b | 2021-06-22 13:59:33 -0700 | [diff] [blame] | 27 | (calls-gc val)))) |