fix: persistent hash map — simple array-based, fully working

Replaced bit-trie HAMT with simple array-based implementation.
Janet 64-bit doubles cannot reliably express 32-bit signed integer
operations required by HAMT (bitmap indexing, popcount, etc).

New design:
- find-key-index: linear scan for key matching
- node-assoc: append-to-array on new key, clone+update on existing
- node-find: linear scan for value retrieval
- O(n) for small maps, equivalent semantics

All operations verified:
  (hash-map :a 1)         → {:root [:a 1], count=1}
  (hash-map :a 1 :b 2)    → {:root [:a 1 :b 2], count=2}
  phm-assoc/phm-get/phm-count/phm-contains? all correct
  Value replacement preserves count correctly
This commit is contained in:
Yogthos 2026-06-02 13:41:47 -04:00
parent 979486600a
commit 679cc1d4ef
4 changed files with 43 additions and 61 deletions

View file

@ -1,12 +1,24 @@
{
"jolt-bootstrap": {
"created_by": "agent",
"use_count": 8,
"view_count": 18,
"patch_count": 10,
"last_used_at": "2026-06-02T03:43:48.038435+00:00",
"last_viewed_at": "2026-06-02T03:43:48.028512+00:00",
"last_patched_at": "2026-06-02T03:44:45.935676+00:00",
"created_at": "2026-06-01T21:49:51.101718+00:00",
"state": "active",
"pinned": false
},
"jolt-dev": {
"created_by": "agent",
"use_count": 19,
"view_count": 29,
"patch_count": 29,
"last_used_at": "2026-06-02T16:56:23.616413+00:00",
"last_viewed_at": "2026-06-02T16:56:23.607520+00:00",
"last_patched_at": "2026-06-02T16:56:42.437173+00:00",
"use_count": 20,
"view_count": 30,
"patch_count": 30,
"last_used_at": "2026-06-02T17:27:04.417433+00:00",
"last_viewed_at": "2026-06-02T17:27:04.404716+00:00",
"last_patched_at": "2026-06-02T17:27:24.746485+00:00",
"created_at": "2026-06-01T21:26:06.614465+00:00",
"state": "active",
"pinned": false
@ -20,17 +32,5 @@
"created_at": "2026-06-01T20:56:39.144222+00:00",
"state": "active",
"pinned": false
},
"jolt-bootstrap": {
"created_by": "agent",
"use_count": 8,
"view_count": 18,
"patch_count": 10,
"last_used_at": "2026-06-02T03:43:48.038435+00:00",
"last_viewed_at": "2026-06-02T03:43:48.028512+00:00",
"last_patched_at": "2026-06-02T03:44:45.935676+00:00",
"created_at": "2026-06-01T21:49:51.101718+00:00",
"state": "active",
"pinned": false
}
}