Liking cljdoc? Tell your friends :D
Clojure only.

ordered-collections.types.fuzzy-map

A map that returns the value associated with the closest key.

When looking up a key, returns the value for the key in the map that is closest to the query. For numeric keys, distance is |query - key|.

Tie-breaking: When two keys are equidistant, use :< to prefer the smaller key, or :> to prefer the larger key.

A map that returns the value associated with the closest key.

When looking up a key, returns the value for the key in the map that is
closest to the query. For numeric keys, distance is |query - key|.

Tie-breaking: When two keys are equidistant, use :< to prefer the
smaller key, or :> to prefer the larger key.
raw docstring

find-nearest-entryclj

(find-nearest-entry root query cmp distance-fn tiebreak)

Find the entry with key nearest to query in the tree.

Parameters:

  • root: the tree root
  • query: the key to find nearest to
  • cmp: comparator for ordering
  • distance-fn: (fn [a b] -> number) returns distance between keys
  • tiebreak: :< (prefer smaller) or :> (prefer larger) when equidistant

Returns [key value] for the nearest entry, or nil if tree is empty.

Find the entry with key nearest to query in the tree.

Parameters:
- root: the tree root
- query: the key to find nearest to
- cmp: comparator for ordering
- distance-fn: (fn [a b] -> number) returns distance between keys
- tiebreak: :< (prefer smaller) or :> (prefer larger) when equidistant

Returns [key value] for the nearest entry, or nil if tree is empty.
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close