# Expect: 6 7 38 # Expect: 6 # Expect: 1 # Expect: -5 11 7 # Expect: [nil] [true] [nil] [nil] [true] # Expect: [true] [nil] [nil] [true] [nil] [true] # Expect: 3 [nil] # Expect: [true] [true] [nil] # Expect: trip-a trip-b # ARITHMETIC (print 6 sp (+ 1 6) sp (+ (+ 2 (+ 1 5)) (+ 10 20)) ln) (print (* (- 7 4 1) (+ 1 (/ 16 4 2))) ln) # Reduces to (* 2 3) (print (% 16 5) ln) # BITS (print (neg 5) sp (& 15 (~ 4)) sp (| 3 6) ln) # LOGIC (print (&& true nil) sp (|| nil true) sp (&& true nil true) sp (|| nil nil nil) sp (! nil) ln) (print (^^ nil true) sp (^^ nil nil) sp (^^ true true) sp (^^ true nil) sp (^^ true nil true) sp (^^ true true true) ln) # ODDITIES AND SHORT CIRCUITING (print (return 3) sp (discard 3 4 5 3 4) ln) # TODO make arg 3 an array (print (&& 3 true) sp (|| "five" nil) sp (^^ true 10) ln) # TODO contrast with true short circuit (&& nil (print "trip-a" sp)) (|| true (print "trip-b" ln))
https://files.mastodon.social/media_attachments/files/114/196/598/009/089/920/original/a58c4f7f3e542702.png