TST.exists-question-mark

You're seeing just the function exists-question-mark, go back to TST module for more information.

Specs

exists?(
  nil
  | %TST{
      item: term(),
      left: term(),
      middle: term(),
      right: term(),
      value: term()
    },
  String.t()
) :: boolean()

Query the TST to see if a key is a valid key

Parameters

  • tst: The Ternary Search Trie if you have saved one, or nil (although this doesn't make much sense to look for valid keys in)
  • key: The key which you are querying whether is valid or not

Examples

iex> TST.new() |> TST.insert("key", "value") |> TST.exists?("key")
true

iex> TST.new() |> TST.insert("key", "value") |> TST.exists?("a whole other key")
false