racket / htdp

Other
91 stars 70 forks source link

Hashes are printed incorrectly in ASL #220

Closed shhyou closed 4 days ago

shhyou commented 5 months ago

In ASL, hashes are constructed using a list of 2-element lists. However, they are printed as a list of pairs in constructor-printing style:
https://docs.racket-lang.org/htdp-langs/advanced.html#%28def._htdp-advanced._%28%28lib._lang%2Fhtdp-advanced..rkt%29._make-hash%29%29

> (make-hash '((b 69) (e 61) (i 999)))
(make-hash (list (cons 'i 999) (cons 'b 69) (cons 'e 61)))

The printed result should have been (make-hash (list (list 'i 999) (list 'b 69) (list 'e 61))).

mfelleisen commented 5 months ago

I don't have time right now to dig into it, but my best guess is that this is a constructor-printer problem. @rfindler ?

rfindler commented 5 months ago

It looks like a mismatch that pconvert has to be adjusted to deal with. This line is correct for #lang racket hashes, I believe, but not ASL ones. Maybe another parameter is needed?

rfindler commented 4 days ago

@jbclements I know that the stepper doesn't work in ASL and hashes aren't in BSL or ISL but I changed the stepper anyway, just in case it is confusing later.