@telepopsound has joined the channel
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.
The name (list) (list "John" "Smith")
is only eq? to itself.
I thought so, just needed a sanity check :)
what is the diff between hash-update! and hash-update , without the exclaimation point?
the exclamation mark one mutates the original hash, the other one leaves it unchanged and returns a new hash
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 ...
One works on mutable hash table. Another works on immutable hash table
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.)
oh wow, I typed my answer on my phone and somehow I didn’t see that you already answered…