[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

circular <= shared

The SRFI fails to distinguish between sharing and circularities. This is important because R5RS *does* specify how non-circular shared structures should be written/displayed(*). For instance
 (define x (cons #f #f))
 (define y (cons 1 1))
 (set-car! x y)
 (set-cdr! x y)
 (write x)
should produce
 ((1 . 1) 1 . 1)
when written in an R5RS-conformant system, and *not*
 (#0=(1 . 1) . #0#)

iirc, Al Petrofsky posted an algorithm that detects circularities without also catching sharing. It has higher computational complexity and is harder to implement than detecting all sharing.

CL makes this distinction. See

(*) Arguably, R5RS even specifies how circular structures should be written - as infinite outputs.