Closed drcxd closed 2 months ago
In Scheme and Racket lists are made of pairs.
The list created by (list 1 2 3)
is internally stored as (cons 1 (cons 2 (cons 3 '())))
.
Here (cons a d)
represents a pair of two values a
and d
.
In Scheme pairs are mutable and in Racket pairs are immutable.
In Racket cons
means an immutable pair and mcons
means a mutable pair.
Since the sicp language attempts to work like Scheme, the sicp list
produces
a list that consists of mutable pairs. This why the normal Racket printer used in
Emacs uses mcons
to print the list.
Due to the way you started scip (in the repl using (require sicp)
), you are
actually still using the normal Racket language, but have imported functions from sicp.
The REPL thus prints all values as if they are Racket values.
I think, you'll need to make a file and use #lang sicp
at the top and run
that file to tell the system you are using the sicp language.
Thanks for the clarification, now I know that it is an issue on the Emacs end.
In DrRacket, if the language is set to
#lang racket/base
, then evaluate a list is printed in the following form:After evaluating
(require sicp)
, lists are printed in a difficult to read form:Could lists be printed in the same way before
(require sicp)
is evaluated? I am asking for this feature because I am using racket in Emacs which can not (or I do not know how to) specify the#lang
line, so I have to evaluate(require sicp)
whenever there is a dependency to it.