Approximate overview
hash-map backwards. Or maybe
the Racket designers did. In any case, it’s (hash-map hash proc).Events
Other good things
How do we submit MP5
I’ll get that up soon.
For MP5, do we have to preserve punctuation?
Nah. But if you want to, that would be great.
A list is either
We can write a cond for that.
(define listp?
(lambda (val)
(cond
[(null? val)
#t]
[(pair? val)
(listp? (cdr val))]
[else
#f])))
Side comment: Standard cond formatting.
We can also make the stucture of listp? match the definition more
closely.
(define listp?
(lambda (val)
(or (null? val)
(and (pair? val)
(listp? (cdr val))))))
Wasn’t that fun?
Side comment: Embrace the ZoB!
hash-set and hash-remove (no exclamation points) return new
hash tables. There is some conceptual benefit to being able to
ensure that the original hash table is not modified.
You can use the new table defined by hash-set or hash-remove
by naming it.
(define new-sidekicks (hash-set sidekicks "Eamon" "Sam"))`
The code in problem 4e should read
> (hash-ref (hash-remove! sidekick-protagonists "The Cheat")
"The Cheat")
Up through 6c