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

Re: [Scheme-reports] Seeking review of sets and hash tables proposals

On 2013/05/25 08:27P, Daniel Hartwig wrote:
> On 24 May 2013 21:55, Alaric Snell-Pym <alaric@x> wrote:
> > 1) What about printed representations? I feel there should be a written
> > syntax for important data structures in Scheme, and that literals should
> > self-evaluate.
> The problem with this is that e.g. a set is a collection of items
> *and* also an equivalence predicate, which can be any arbitrary
> procedure, and arbitrary procedures can not be written out.

Literal sets or hash tables could be defined as having a specific
equivalence procedure.

Alternatively, the proposal could be changed to specify a default
equivalence when none is provided (e.g. (make-set) = (make-set equal?)),
with printed representations having that equivalence.

I like this idea, but it would probably come with lots of complications.
For example, one wouldn't be able to rely on the ability to round-trip
such an object through its written representation (and what exactly
should happen when the equivalence is not the default? Raise an error?
Write "#<hash-table>" instead? How would one test its printability?).


Scheme-reports mailing list