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

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



On 25 May 2013 08:41, Noah Lavine <noah.b.lavine@x> wrote:
>
> On Fri, May 24, 2013 at 5:27 PM, Daniel Hartwig <mandyke@x> 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. Needless to say, I don't think "Oh, just write out code
>> > that will construct one" is very useful, as that only solves the problem
>> > for literals in source code - not for being able to write and then read
>> > an sexpr to communicate data across a channel.
>> >
>>
>> 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.
>
>
> That is true, but I imagine by far the most common case will be sets with
> eq?, eqv?, or equal? as their predicate.

Questionable.

> A syntax for just those sets would
> still be very useful.
>

More special casing which is undesirable and makes specifications
harder to follow.  Anyway, that is still problematic as in this
pathological example:

;; #setv(x ...) is a literal form of ‘(set eqv? x ...)’
(define foo #setv(0 1 2))
(define bar (set eqv? 0 1 2))
(set=? foo bar) => #t ; presumably, although foo is immutable by
virtue of being a literal
(display bar) => #setv(0 1 2)

;; Somewhere along the line, ‘eqv?’ changes …
(define eqv? (lambda (a b) (not (equal? a b))))
;; … but noone told me!
(define quaz (set eqv? 0 1 2))
(set=? foo quaz) => #f ; expecting #t
(display quaz) => ?? ; unspecified, expecting #setv(0 1 2)


When dealing with an arbitrary set you dont know whether it has the
printed representation of blessed sets or the “other” representation.

_______________________________________________
Scheme-reports mailing list
Scheme-reports@x
http://lists.scheme-reports.org/cgi-bin/mailman/listinfo/scheme-reports