Skip to content

Commit 236b7fc

Browse files
committed
add key-index-of, tag 0.0.16
1 parent 98a9fc6 commit 236b7fc

File tree

6 files changed

+110
-22
lines changed

6 files changed

+110
-22
lines changed

.github/workflows/tests.yaml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,10 @@ jobs:
1414

1515
- uses: actions/setup-node@v4
1616
with:
17-
node-version: 20
17+
node-version: 22
1818
cache: 'yarn'
1919

20-
- uses: calcit-lang/[email protected]
21-
with:
22-
bundler: false
20+
- uses: calcit-lang/[email protected]
2321

2422
- name: "test"
2523
run: caps --ci && cr --entry test -1

calcit.cirru

Lines changed: 83 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

compact.cirru

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
{} (:package |bisection-key)
3-
:configs $ {} (:init-fn |bisection-key.main/main!) (:reload-fn |bisection-key.main/reload!) (:version |0.0.15)
3+
:configs $ {} (:init-fn |bisection-key.main/main!) (:reload-fn |bisection-key.main/reload!) (:version |0.0.16)
44
:modules $ []
55
:entries $ {}
66
:test $ {} (:init-fn |bisection-key.test/run-tests) (:port 6001) (:reload-fn |bisection-key.test/run-tests)
@@ -333,6 +333,12 @@
333333
= (assoc v "\"aT" 4) (assoc-before-nth v 1 4)
334334
testing "\"set value after nth" $ is
335335
= (assoc v "\"bT" 4) (assoc-after-nth v 1 4)
336+
testing "\"find key index a" $ is
337+
= 0 $ key-index-of v "\"a"
338+
testing "\"find key index c" $ is
339+
= 2 $ key-index-of v "\"c"
340+
testing "\"find key index missing" $ is
341+
= nil $ key-index-of v "\"d"
336342
|test-prepend $ %{} :CodeEntry (:doc |)
337343
:code $ quote
338344
deftest test-prepend
@@ -355,9 +361,9 @@
355361
:ns $ %{} :CodeEntry (:doc |)
356362
:code $ quote
357363
ns bisection-key.test $ :require
358-
[] calcit-test.core :refer $ [] deftest is testing run-tests
359-
[] bisection-key.core :refer $ [] max-id min-id mid-id bisect
360-
[] bisection-key.util :refer $ [] key-before key-after assoc-before assoc-after key-prepend key-append assoc-prepend assoc-append get-min-key get-max-key key-nth val-nth assoc-nth assoc-before-nth assoc-after-nth
364+
calcit-test.core :refer $ deftest is testing run-tests
365+
bisection-key.core :refer $ max-id min-id mid-id bisect
366+
bisection-key.util :refer $ key-before key-after assoc-before assoc-after key-prepend key-append assoc-prepend assoc-append get-min-key get-max-key key-nth val-nth assoc-nth assoc-before-nth assoc-after-nth key-index-of
361367
|bisection-key.util $ %{} :FileEntry
362368
:defs $ {}
363369
|assoc-after $ %{} :CodeEntry (:doc |)
@@ -455,6 +461,14 @@
455461
bisect
456462
if (= 0 position) min-id $ get existing-keys (dec position)
457463
, base-key
464+
|key-index-of $ %{} :CodeEntry (:doc "|find index of `k`, returns `nil` if not found")
465+
:code $ quote
466+
defn key-index-of (x k)
467+
let
468+
ks $ sort
469+
&set:to-list $ keys x
470+
, &compare
471+
index-of ks k
458472
|key-nth $ %{} :CodeEntry (:doc |)
459473
:code $ quote
460474
defn key-nth (x n)

deps.cirru

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

22
{}
3-
:calcit-version |0.9.5
3+
:calcit-version |0.9.8
44
:dependencies $ {}
55
|calcit-lang/calcit-test |0.0.5

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
2-
"version": "0.0.15",
2+
"version": "0.0.16",
33
"dependencies": {
4-
"@calcit/procs": "^0.9.5"
4+
"@calcit/procs": "^0.9.8"
55
},
66
"scripts": {
77
"watch": "cr --emit-js"

yarn.lock

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)