compile/set!

Syntax: (set! SYM EXPR), (set! (item OBJ KEY) EXPR), (set! (attr OBJ NAME) EXPR), (set! (deref REF) EXPR), (set! (values PATTERN ...) EXPR)

Behaviour: Stores EXPR into the target, choosing the special by the target’s shape: setq for a variable, set-item and set-attr for a subscript and an attribute, set-ref through a deref, and setq-values for a pattern. The subscript and dot suffixes read to the item and attribute forms, so d["k"] and obj.attr are targets. An augmented store on a variable, (set! x (+ x 1)), lowers to inplace, and on an item or attribute to its in-place special.

Examples:

var x 6
set! x 7

set! obj.count 0
set! d["k"] v

var r &x
set! (deref r) 8        ;; x is now 8

var point #(5 6)
set! (values a b) point

See also: incr!, decr!, Bindings and refs.