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 | ||||
swissChili | 6b47b6d | 2021-06-30 22:08:55 -0700 | [diff] [blame] | 14 | (list 12 34 56) |
15 | (list "a" "b" "c" "d") | ||||
swissChili | e9fec8b | 2021-06-22 13:59:33 -0700 | [diff] [blame] | 16 | |
swissChili | b8fd471 | 2021-06-23 15:32:04 -0700 | [diff] [blame] | 17 | ; But these should not |
swissChili | e9fec8b | 2021-06-22 13:59:33 -0700 | [diff] [blame] | 18 | (let1 (unused-but-bound (cons 5 6)) |
swissChili | 6b47b6d | 2021-06-30 22:08:55 -0700 | [diff] [blame] | 19 | (let1 (val '(a b c d e)) |
swissChili | e9fec8b | 2021-06-22 13:59:33 -0700 | [diff] [blame] | 20 | (calls-gc val)))) |