Skip to content

Commit

Permalink
Corrected corner case in map function.
Browse files Browse the repository at this point in the history
  • Loading branch information
sirherrbatka committed Oct 1, 2022
1 parent 03e741a commit 93cbd11
Showing 1 changed file with 16 additions and 15 deletions.
31 changes: 16 additions & 15 deletions src/common/rrb/common.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -1093,20 +1093,21 @@
(cl-ds.utils:cases ((null leaf-function) (null tree-function))
(labels ((impl (node n)
(declare (type fixnum n))
(if (= n depth)
(unless (null leaf-function)
(funcall leaf-function node))
(progn
(unless (null tree-function)
(funcall tree-function node))
(iterate
(declare (type fixnum i next-n)
(type simple-vector ocntent))
(with next-n = (1+ n))
(with content = (sparse-rrb-node-content node))
(with length = (sparse-rrb-node-size node))
(for i from 0 below length)
(for elt = (svref content i))
(impl elt next-n))))))
(unless (cl-ds.meta:null-bucket-p node)
(if (= n depth)
(unless (null leaf-function)
(funcall leaf-function node))
(progn
(unless (null tree-function)
(funcall tree-function node))
(iterate
(declare (type fixnum i next-n)
(type simple-vector content))
(with next-n = (1+ n))
(with content = (sparse-rrb-node-content node))
(with length = (sparse-rrb-node-size node))
(for i from 0 below length)
(for elt = (svref content i))
(impl elt next-n)))))))
(impl tree 0)
tree)))

0 comments on commit 93cbd11

Please sign in to comment.