Racket Doc on Lisp Cons Problem

By Xah Lee. Date: .

Racket Lisp Doc on Cons Problem

Racket's doc explain the cons problem well.

racket lisp doc cons 2021-11-26
racket lisp doc cons 2021-11-26 http://docs.racket-lang.org/guide/Pairs__Lists__and_Racket_Syntax.html

Note that it says:

Racket's pair datatype and its relation to lists is essentially a historical curiosity, along with the dot notation for printing and the funny names car and cdr. Pairs are deeply wired into the culture, specification, and implementation of Racket, however, so they survive in the language.

racket lisp doc cons 2021-11-26 xfBXx
racket lisp doc cons 2021-11-26 xfBXx http://docs.racket-lang.org/guide/Pairs__Lists__and_Racket_Syntax.html

Note the issue (+ 1 . (2)), quote:

One consequence of the read layer for expressions is that you can use the dot notation in expressions that are not quoted forms:

(+ 1 . (2))

This works because (+ 1 . (2)) is just another way of writing (+ 1 2). It is practically never a good idea to write application expressions using this dot notation; it's just a consequence of the way Racket's syntax is defined.