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

circular <= shared

This page is part of the web mail archives of SRFI 38 from before July 7th, 2015. The new archives for SRFI 38 contain all messages, not just those from before July 7th, 2015.

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.