telepopsound
2021-2-16 14:13:45

@telepopsound has joined the channel


badkins
2021-2-16 18:51:48

I have a list of names. The names are represented as a list of strings e.g. (list (list "John" "Smith") (list "Susan" "Jones") ... ) I want to compare (in a special way) each name to all of the other names except itself. Is using eq? going to allow me to skip comparing a name w/ itself in all cases? In other words, there is never a scenario where Racket moves an object under the covers so to speak.


soegaard2
2021-2-16 18:53:40

The name (list) (list "John" "Smith") is only eq? to itself.


badkins
2021-2-16 18:55:33

I thought so, just needed a sanity check :)


jestarray
2021-2-16 23:20:50

what is the diff between hash-update! and hash-update , without the exclaimation point?


notjack
2021-2-16 23:37:02

the exclamation mark one mutates the original hash, the other one leaves it unchanged and returns a new hash


notjack
2021-2-16 23:39:06

mutable version: (define h (get-hash-from-somewhere)) (hash-update! h 'a add1) ... now the key 'a in h is updated ... immutable version: (define h (get-hash-from-somewhere)) (define new-h (hash-update h 'a add1)) ... now the key 'a in new-h is updated, but it's not updated in h, there's two different hashes ...


sorawee
2021-2-16 23:40:16

One works on mutable hash table. Another works on immutable hash table


greg
2021-2-17 00:50:50

hash-update! works a little faster because you’re yelling at it. (OK I’m being a smarty-pants, but mutating a hash-table generally is somewhat faster. Not that you should necessarily choose a mutable hash-table only for speed — or necessarily worry too much about speed before making things work correctly and reliably.)


sorawee
2021-2-17 02:29:15

oh wow, I typed my answer on my phone and somehow I didn’t see that you already answered…