Skip to content

Commit 6193004

Browse files
committed
Speed up by avoiding multiple loops through the lines
1 parent 5bb8f0a commit 6193004

File tree

1 file changed

+2
-3
lines changed
  • src/tech/thomas_sojka/org_parser_tree

1 file changed

+2
-3
lines changed

src/tech/thomas_sojka/org_parser_tree/core.clj

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@
3131

3232
(defn build-tree [lines]
3333
(reduce
34-
stratify
34+
(fn [org-tree line]
35+
((comp (partial stratify org-tree) transform) line))
3536
(z/zipper (comp sequential? :children)
3637
:children
3738
(fn [node children] (assoc node :children children))
@@ -42,8 +43,6 @@
4243
(->> org-file-string
4344
parser/org
4445
(drop 1)
45-
(remove (fn [[type]] (= type :empty-line)))
46-
(map transform)
4746
build-tree
4847
z/root))
4948

0 commit comments

Comments
 (0)