Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #lang racket
- (define mh (make-hash))
- (hash-set! mh 1 "one")
- (hash-set! mh 2 "two")
- (define (fail-hash val)
- (printf "no such key: ~a\n " val))
- (hash-ref mh 1)
- (hash-ref mh 10 (lambda () (fail-hash 10)))
- ;; output:
- ;; "one"
- ;; no such key: 10
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement