Skip to content
Jan Špaček edited this page Apr 12, 2016 · 1 revision

Mutable references are boxes with value that can be imperatively changed. They behave as one-element arrays, but are more efficient. When two refs are compared by equal?, the current content is ignored -- two refs are eqv? or equal? only if they are the same object.

  • (ref-new val) creates a new mutable reference with value val.
  • (ref? x) returns true if x is a mutable reference.
  • (ref-get ref) returns the value currently held in ref.
  • (ref-set! ref val) assigns the val into the ref.