Skip to content

Commit bd32bd6

Browse files
committed
more helper functions related to nth; alpha release
1 parent 1ddf90b commit bd32bd6

File tree

5 files changed

+577
-14
lines changed

5 files changed

+577
-14
lines changed

README.md

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ bisection-key
1212

1313
[![Clojars Project](https://img.shields.io/clojars/v/cirru/bisection-key.svg)](https://clojars.org/cirru/bisection-key)
1414

15+
Under `bisection-key.core`:
16+
1517
```clojure
1618
; make sure the first parameter is littler
1719
(bisection-key.core/bisect "a" "c") ; "b"
@@ -21,20 +23,29 @@ bisection-key
2123
bisection-key.core/min-id ; "+"
2224
bisection-key.core/mid-id ; "T"
2325
bisection-key.core/max-id ; "z"
26+
```
2427

28+
Functions under `bisection-key.util`:
29+
30+
```clojure
2531
; (def v {"a" 1, "b" 1})
26-
(bisection-key.util/key-before v "b") ; "aT"
27-
(bisection-key.util/key-after v "a") ; "aT"
28-
(bisection-key.util/key-prepend v) ; "G"
29-
(bisection-key.util/key-append v) ; "n"
30-
31-
(bisection-key.util/assoc-after v "a" 2) ; (assoc v "aT" 2)
32-
(bisection-key.util/assoc-before v "b" 2) ; (assoc v "aT" 2)
33-
(bisection-key.util/assoc-prepend v 2) ; (assoc v "G" 2)
34-
(bisection-key.util/assoc-append v 2) ; (assoc v "n" 2)
35-
36-
(bisection-key.util/get-min-key v) ; "a"
37-
(bisection-key.util/get-max-key v) ; "b"
32+
(key-before v "b") ; "aT"
33+
(key-after v "a") ; "aT"
34+
(key-prepend v) ; "G"
35+
(key-append v) ; "n"
36+
(key-nth v 0) ; "a"
37+
(val-nth v 0) ; 1
38+
39+
(assoc-after v "a" 2) ; (assoc v "aT" 2)
40+
(assoc-before v "b" 2) ; (assoc v "aT" 2)
41+
(assoc-prepend v 2) ; (assoc v "G" 2)
42+
(assoc-append v 2) ; (assoc v "n" 2)
43+
(assoc-nth v 0 2) ; (assoc v "a" 2)
44+
(assoc-before-nth v 1 2) ; (assoc v "aT" 2)
45+
(assoc-after-nth v 1 2) ; (assoc v "n" 2)
46+
47+
(get-min-key v) ; "a"
48+
(get-max-key v) ; "b"
3849
```
3950

4051
Charset:

0 commit comments

Comments
 (0)