On this page:
label-id-representative
label-identifier=?
check-duplicate-label
make-label-id-table
make-immutable-label-id-table
make-weak-label-id-table
label-identifier-hash-code
free-identifier-hash-code
bound-identifier-hash-code
8.12
3.3.3 mischief/id-table: Dictionaries for Identifiers🔗ℹ

 (require mischief/id-table) package: mischief

procedure

(label-id-representative id)  identifier?

  id : identifier?
Strips the bindings from id and produces an identifier with the same symbolic name and the same marks.

procedure

(label-identifier=? one two)  boolean?

  one : identifier?
  two : identifier?
Reports whether one and two have the same symbolic name and marks, regardless of their bindings. Equivalent to:

procedure

(check-duplicate-label ids)  (or/c identifier? #false)

  ids : (listof identifier?)
If any elements of ids are label-identifier=? to each other, returns one of the duplicates. Otherwise, returns #false.

procedure

(make-label-id-table [init])  (dict/c identifier? any/c)

  init : (dict/c identifier? any/c) = '()

procedure

(make-immutable-label-id-table [init])

  (dict/c identifier? any/c)
  init : (dict/c identifier? any/c) = '()

procedure

(make-weak-label-id-table [init])  (dict/c identifier? any/c)

  init : (dict/c identifier? any/c) = '()
Creates a hash table-based dictionary—mutable, immutable, or weak, respectively—that maps identifiers based on label-identifier-hash-code and label-identifier=?. Populates the hash table with the contents of init.

procedure

(label-identifier-hash-code id [rec])  exact-integer?

  id : identifier?
  rec : (-> any/c exact-integer?) = equal-hash-code
Computes a unique hash code for id that is consistent with label-identifier=?, using rec to compute the hash code for id’s symbolic name.

procedure

(free-identifier-hash-code id    
  [rec    
  #:phase phase])  exact-integer?
  id : identifier?
  rec : (-> any/c exact-integer?) = equal-hash-code
  phase : (or/c exact-nonnegative-integer? #false)
   = (syntax-local-phase-level)
Computes a unique hash code for id that is consistent with free-identifier=? in phase, using rec to compute the hash code for the symbolic name of id’s binding.

procedure

(bound-identifier-hash-code id    
  [rec    
  #:phase phase])  exact-integer?
  id : identifier?
  rec : (-> any/c exact-integer?) = equal-hash-code
  phase : (or/c exact-nonnegative-integer? #false)
   = (syntax-local-phase-level)
Computes a unique hash code for id that is consistent with bound-identifier=? in phase, using rec to compute the hash code for id’s symbolic name.