Utils for lexical sorting and searching
Utils for lexical sorting and searching
(->sorted-set)
(->sorted-set some-set)
Inputs: ([] [some-set :- (s/cond-pre tsk/Set tsk/Vec)]) Returns: Set
Converts a set into a lexically-sorted set
Inputs: ([] [some-set :- (s/cond-pre tsk/Set tsk/Vec)]) Returns: Set Converts a set into a lexically-sorted set
(bound-lower val)
Inputs: [val :- tsk/Vec] Returns: tsk/Vec
Given a lexical value as a vector such as [1 :a], returns a lower bound like [1]
Inputs: [val :- tsk/Vec] Returns: tsk/Vec Given a lexical value as a vector such as [1 :a], returns a lower bound like [1]
(compare-lex a b)
Inputs: [a :- tsk/Vec b :- tsk/Vec] Returns: s/Int
Performs a lexical comparison of 2 sequences, sorting as follows: [1] [1 nil] [1 :a] [1 :b] [1 :b 3] [2] [3] [3 :y]
Inputs: [a :- tsk/Vec b :- tsk/Vec] Returns: s/Int Performs a lexical comparison of 2 sequences, sorting as follows: [1] [1 nil] [1 :a] [1 :b] [1 :b 3] [2] [3] [3 :y]
(prefix-match? pattern sample)
Inputs: [pattern :- Val sample :- Val] Returns: s/Bool
Returns true if the sample value equals the pattern when truncated to the same length
Inputs: [pattern :- Val sample :- Val] Returns: s/Bool Returns true if the sample value equals the pattern when truncated to the same length
(split-key-prefix match-val lex-set)
Inputs: [match-val :- Val lex-set :- Set] Returns: #:s{Keyword Set}
Like clojure.data.avl/split-key, but allows prefix matches. Given a lexically sorted set like: #{[:a 1] [:a 2] [:a 3] [:b 1] [:b 2] [:b 3] [:c 1] [:c 2]} splits data by prefix match for patterns like [:b], returning a map of 3 sorted sets like: {:smaller #{[:a 1] [:a 2] [:a 3]} :matches #{[:b 1] [:b 2] [:b 3]} :larger #{[:c 1] [:c 2]} ]
Inputs: [match-val :- Val lex-set :- Set] Returns: #:s{Keyword Set} Like clojure.data.avl/split-key, but allows prefix matches. Given a lexically sorted set like: #{[:a 1] [:a 2] [:a 3] [:b 1] [:b 2] [:b 3] [:c 1] [:c 2]} splits data by prefix match for patterns like [:b], returning a map of 3 sorted sets like: {:smaller #{[:a 1] [:a 2] [:a 3]} :matches #{[:b 1] [:b 2] [:b 3]} :larger #{[:c 1] [:c 2]} ]
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close