Liking cljdoc? Tell your friends :D

ordered-collections.types.fuzzy-set

A set that returns the closest element to a query.

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

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

A set that returns the closest element to a query.

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

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

find-nearestclj

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

Find the nearest element to query in the tree.

Parameters:

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

Returns the nearest element, or nil if tree is empty.

Find the nearest element to query in the tree.

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

Returns the nearest element, or nil if tree is empty.
sourceraw docstring

numeric-distanceclj

(numeric-distance a b)

Default distance function for numeric types.

Default distance function for numeric types.
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