The car of a weak pair holds its pointer weakly, while the cdr holds its pointer strongly. If the object in the car of a weak pair is not held strongly by any other data structure, it will be garbage-collected, and the original value replaced with a unique reclaimed object.
Note: weak pairs can be defeated by cross references among their slots. Consider a weak pair P holding an object A in its car and an object D in its cdr. P points to A weakly and to D strongly. If D holds A strongly, however, then P ends up holding A strongly after all. If avoiding this is worth a heavier-weight structure, See Ephemerons.
Note: weak pairs are not pairs; that is, they do not satisfy the
#t if object is a weak pair; otherwise returns
Allocates and returns a new weak pair, with components car and cdr. The car component is held weakly.
#t if object is the reclaimed object, and
Returns the reclaimed object.
This predicate returns
#f if the car of weak-pair has been
garbage-collected; otherwise returns
#t. In other words, it is
true if weak-pair has a valid car component.
This is equivalent to
(not (gc-reclaimed-object? (weak-car weak-pair)))
This predicate has been deprecated; instead use
gc-reclaimed-object?. Please note that the previously
recommended way to use
weak-pair/car? will no longer work, so
any code using it should be rewritten.
Returns the car component of weak-pair. If the car component has been garbage-collected, this operation returns the reclaimed object.
Sets the car component of weak-pair to object and returns an unspecified result.
Returns the cdr component of weak-pair.
Sets the cdr component of weak-pair to object and returns an unspecified result.