2 ms·
Let's muddy the waters a little: This is the TXR Lisp interactive listener of TXR 215. Quit with :quit or Ctrl-D on empty line. Ctrl-X ? for cheatsheet.
by kazinator 8y ago
Let's muddy the waters a little:
This is the TXR Lisp interactive listener of TXR 215.
Quit with :quit or Ctrl-D on empty line. Ctrl-X ? for cheatsheet.
1> (defstruct fixed-list nil
a b c
(:method car (me) me.a)
(:method cdr (me) (list me.b me.c)))
#<struct-type fixed-list>
2> (new fixed-list a 1 b 2 c 3)
#S(fixed-list a 1 b 2 c 3)
3> (car *2)
1
4> (cdr *2)
(2 3)
5> [mapcar square *2]
(1 4 9)
6> (cons 0 *2)
(0 . #S(fixed-list a 1 b 2 c 3))
7> [mapcar square (cons 0 *2)]
(0 1 4 9)
:)