Skip to content

Instantly share code, notes, and snippets.

@bis83
Created October 12, 2015 14:57
Show Gist options
  • Save bis83/cd97dc11f86cef6e4689 to your computer and use it in GitHub Desktop.
Save bis83/cd97dc11f86cef6e4689 to your computer and use it in GitHub Desktop.
hash-by-identity
(use srfi-69)
(define h (make-hash-table eq? hash-by-identity))
(define a (cons 'a 'b))
(define b (cons 'a 'b))
(hash-table-set! h a 10)
(hahs-table-set! h b 20)
(hash-table-ref h a)
; ==> 10
(hash-table-ref h b)
; ==> 20
(hash-table-ref h (cons 'a 'b))
; ==> error!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment