I am attempting to use the #‹digit10›{1,8}=
and #‹digit10›{1,8}#
syntax as described in The Reader, but receive the read-syntax: `#...=` forms not enabled
when I do so:
This code has been run a DrRacket REPL with only #lang racket in the edit area, and in the racket
program through a terminal emulator with no further arguments or (require ...)
s.
racket> (list #1=100 #1# #1#)
==> read-syntax: `#...=` forms not enabled
Reading states that the parameter read-accept-graph
determines whether the reader will parse graph syntax. What's strange is that the parameter is currently set to #t
.
racket> (read-accept-graph)
==> #t
The following confirms that read-accept-graph changes how the reader reacts to graph syntax:
racket> (parameterize ([read-accept-graph #t])
(read (open-input-string "(list #1=100 #1# #1#)")))
==> '(list 100 100 100)
racket> (parameterize ([read-accept-graph #f])
(read (open-input-string "(list #1=100 #1# #1#)")))
==> string::7: read: `#...=` forms not allowed in `read-syntax` mode
It seems that the problem is that read-accept-graph
is bound to #f
at the moment when racket is reading the expressions, even if it might be #t
by the time those expressions are executed.
TLDR:
How do I parameterize read-accept-graph
to #t
before expressions containing graph structure are read?