Skip to content

Commit 5cc0222

Browse files
committed
Support IPersistentVector interface
Fixes e/patch with diffs
1 parent a89d981 commit 5cc0222

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

src/xitdb/array_list.clj

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,13 @@
3131

3232
clojure.lang.Sequential ;; Add this to mark as sequential
3333

34+
clojure.lang.IPersistentVector
35+
(assocN [this i val]
36+
(throw (UnsupportedOperationException. "XITDBArrayList is read-only")))
37+
38+
(length [this]
39+
(.count ral))
40+
3441
clojure.lang.Indexed
3542
(nth [_ i]
3643
(let [cursor (.getCursor ral (long i))]
@@ -88,6 +95,12 @@
8895
(aset result len nil))
8996
result))
9097

98+
clojure.lang.IPersistentVector
99+
(assocN [this i val]
100+
(throw (UnsupportedOperationException. "XITDBArrayList is read-only")))
101+
102+
(length [this]
103+
(.count ral))
91104

92105
common/IUnwrap
93106
(-unwrap [this]
@@ -139,6 +152,14 @@
139152
(common/-read-from-cursor (.putCursor wal i))
140153
not-found))
141154

155+
clojure.lang.IPersistentVector
156+
(assocN [this i val]
157+
(util/array-list-assoc-value! wal i (common/unwrap val))
158+
this)
159+
160+
(length [this]
161+
(.count wal))
162+
142163
clojure.lang.Associative
143164
(assoc [this k v]
144165
(when-not (integer? k)

0 commit comments

Comments
 (0)