chickadee » hash-trie » hash-trie/update

hash-trie/update HASH-TRIE KEY IF-FOUND IF-NOT-FOUNDprocedure

Searches for an association for KEY in HASH-TRIE. If there is one, tail-calls IF-FOUND with three arguments:

  • the associated datum
  • a procedure (REPLACE DATUM) that returns a new hash trie with all the associations in HASH-TRIE, but with DATUM substituted for the datum associated with KEY
  • a procedure (DELETE) that returns a new hash trie with all the associations in HASH-TRIE excluding the association for KEY

If there is no such association, tail-calls IF-NOT-FOUND with one argument, a procedure (INSERT DATUM) that returns a new hash trie with all the associations in HASH-TRIE as well as an association of DATUM with KEY.