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 | 6d6525e | 2021-06-15 21:20:53 -0700 | [diff] [blame] | 8 | (defun main () |
swissChili | e9fec8b | 2021-06-22 13:59:33 -0700 | [diff] [blame] | 9 | (let1 (a (add-two 3)) |
swissChili | 67bdf28 | 2021-06-06 18:46:08 -0700 | [diff] [blame] | 10 | (print "a is") |
swissChili | e9fec8b | 2021-06-22 13:59:33 -0700 | [diff] [blame] | 11 | (print a)) |
swissChili | b8fd471 | 2021-06-23 15:32:04 -0700 | [diff] [blame] | 12 | |
13 | ; These allocations should be freed | ||||
14 | (cons 12 (cons 34 (cons 45 nil))) | ||||
swissChili | e9fec8b | 2021-06-22 13:59:33 -0700 | [diff] [blame] | 15 | |
swissChili | b8fd471 | 2021-06-23 15:32:04 -0700 | [diff] [blame] | 16 | ; But these should not |
swissChili | e9fec8b | 2021-06-22 13:59:33 -0700 | [diff] [blame] | 17 | (let1 (unused-but-bound (cons 5 6)) |
18 | (let1 (val (cons 1 (cons 2 (cons 3 nil)))) | ||||
19 | (calls-gc val)))) | ||||
swissChili | b6c858c | 2021-06-30 21:12:43 -0700 | [diff] [blame] | 20 | |
21 | '(hello) |