nested-hash
nested-hash-ref
nested-hash-set
7.0

nested-hash

Kevin R. Stravers

 (require nested-hash) package: nested-hash

procedure

(nested-hash-ref hash*    
  key ...+    
  [#:default default])  any?
  hash* : hash?
  key : any/c
  default : any/c = #f
Accesses a hash table recursively using the given keys. default is returned if a key does not exist. An error is raised if an access is performed on a non-hash entry.

procedure

(nested-hash-set hash* key ...+ value)  any?

  hash* : hash?
  key : any/c
  value : any/c
Functionally edits a hash table using the given keys and value. Non-existent keys will automatically become new subtables. Existing intermediate keys that are associated with non-hash values will raise an error.

Examples:
> (nested-hash-ref (hash 'a (hash 'b 123)) 'a 'b)

123

> (nested-hash-set (hash) 'a 'b 123)

'#hash((a . #hash((b . 123))))