#0# used in a Racket printer to describe cyclic data structures or shared memory objects. Basically, the way it works is that there is an object that is tagged, say, #0= , and then when you see #0# , it refers to that object.
So for example:
#0=(1 .
A list of infinite length containing only 1 s. He does this because the created data structure is only a pair of minus, where the first element is 1 and the second element points to itself.
You can have any number of them to create more complex chart structures. For instance:
#0=(
Finally, you do not have to have a circular data structure. Suppose x was the following data structure:
'(
(wehre #& is a mutable field), mutation of an element in the first element of a pair additionally mutates an element in the second part of a pair. So, if this pair was set to the variable x , then:
> x '(#0=#&42 . #0#) > (set-box! (car x) 43) > (car x) '
Usually you cannot write this directly to code directly in the code, but you can build it with read .
> (define x (read)
You can also change the reader to just put it in the code directly from read-accept-graph when reading in the module source code.
source share