blob: 45c8be41864affac08213c19d0c867c24ecdf2fd [file] [log] [blame]
swissChili923b5362021-05-09 20:31:43 -07001(defun add-two (a)
2 (+ a 2))
swissChilia820dea2021-05-09 16:46:55 -07003
swissChilie9fec8b2021-06-22 13:59:33 -07004(defun calls-gc (whatever)
5 (print whatever)
6 (gc))
swissChili67bdf282021-06-06 18:46:08 -07007
swissChili2999dd12021-07-02 14:19:53 -07008(defmacro weird-identity (a)
9 a)
10
11(defmacro weird-const (a b)
12 a)
13
swissChili6d6525e2021-06-15 21:20:53 -070014(defun main ()
swissChilie9fec8b2021-06-22 13:59:33 -070015 (let1 (a (add-two 3))
swissChili67bdf282021-06-06 18:46:08 -070016 (print "a is")
swissChili2999dd12021-07-02 14:19:53 -070017 (print (weird-identity a))
18 (print (weird-const a 4)))
swissChilib8fd4712021-06-23 15:32:04 -070019
20 ; These allocations should be freed
swissChili6b47b6d2021-06-30 22:08:55 -070021 (list 12 34 56)
22 (list "a" "b" "c" "d")
swissChilie9fec8b2021-06-22 13:59:33 -070023
swissChilib8fd4712021-06-23 15:32:04 -070024 ; But these should not
swissChilie9fec8b2021-06-22 13:59:33 -070025 (let1 (unused-but-bound (cons 5 6))
swissChili6b47b6d2021-06-30 22:08:55 -070026 (let1 (val '(a b c d e))
swissChilie9fec8b2021-06-22 13:59:33 -070027 (calls-gc val))))