3.13 Holes
Holes are a simple mutable data structure based on Racket boxes, with an API inspired by Clojure’s atoms. Their purpose is to provide an in-memory data store that is treated as a first-class value, which thus can be bound to a value or passed to functions. They can also be useful for providing a source of shared program state.
Creates a hole containing v.
Returns True if v is a hole.
Returns the current value contained within hol.
Resets the current value of hol to new-val, returning the hole.
Resets the current value of hol to the result if applying fn to the current
value of hol, followed by args, ie. (apply f curr-val args).
syntax
(reset-thing [hol hole?] (field value) ...)
Resets the fields of a Thing contained in hol to the values provided, and returns
the hole.
Applies fn to the value contained by hol. The monadic bind (>>=) operator for holes.
procedure
(hole-guard test) → any?
test : boolean?
The monadic guard operator for holes. Primarily of use for the hole-do DSL.