-
Notifications
You must be signed in to change notification settings - Fork 2
seq
TurtleKitty edited this page May 11, 2019
·
2 revisions
This is used to execute a set of expressions in order, returning the last one. Its primary use is for side effects. Since functions, operators, and derived control structures (like let) have an implied seq, this operator is primarily of use in conditionals, which expect consequents and alternatives to be single expressions.
(def x (cell 1))
(if true (seq x.inc! x.get) 0) ; 2
(cond
(= 0 x.get) 'zero
(= 1 x.get) 'one
else: (seq (say "Greater than one!") x))
; Greater than one!
; #(cell 2)