3 ms·
> Note that this will probably break a ton of stuff. To me, the correct way to interpret “It's possible. Just do this thing that breaks pretty much all existin
by catnaroek 10y ago
> Note that this will probably break a ton of stuff.
To me, the correct way to interpret “It's possible. Just do this thing that breaks pretty much all existing code.” is “It's not possible.” And your solution still doesn't fix the lack of compound values.
> Hey, watch this! (snippet)
(0) I said Racket for a reason.
(1) A better objection would've been using `set-car!` to replace "hello" with "goodbye" in-place. But Racket doesn't have `set-car!` or `set-cdr!`.
- qwertyuiop924 10y agoTo me, the correct way to interpret “It's possible. Just do this thing that breaks pretty much all existing code.” is “It's not possible.” And your solution still doesn't fix the lack of compound values. Oh, it just breaks stuff that uses eq. Which you didn't want anyway, right? >I said Racket for a reason. Last I checked, that's totally valid Racket. And it has the same effect as using set-car!.
- catnaroek 10y ago> Last I checked, that's totally valid Racket. And it has the same effect as using set-car!. No. There's an important difference. This is valid Scheme and Racket: (define x (list "hello" "world")) (define y x) (set! x (list "goodbye" "world")) ;; y is still (list "hello" "world") But this isn't valid Racket: (define x (list "hello" "world")) (define y x) (set-car! x "goodbye") ;; now y is (list "goodbye" "world") too Racket has a separate (dynamic) type of mutable cons cells, together with `set-mcar!` and `set-mcdr!` operations. In Racket, cons cells are bona fide compound values, but the object identity of an mcons cells is a primitive value.