♻️ Ensure a correct usage of concat/into operations.

This commit is contained in:
Andrey Antukh 2021-11-30 19:02:27 +01:00 committed by Alonso Torres
parent b897f202dd
commit 6a7600fd52
42 changed files with 461 additions and 383 deletions

View file

@ -60,14 +60,14 @@
param-list (extract-params cmd [[:x :number]
[:y :number]])]
(d/concat [{:command :move-to
:relative relative
:params (first param-list)}]
(into [{:command :move-to
:relative relative
:params (first param-list)}]
(for [params (rest param-list)]
{:command :line-to
:relative relative
:params params}))))
(for [params (rest param-list)]
{:command :line-to
:relative relative
:params params}))))
(defmethod parse-command "Z" [_]
[{:command :close-path}])
@ -259,7 +259,7 @@
(update :params merge (quadratic->curve prev-pos (gpt/point params) (upg/calculate-opposite-handler prev-pos prev-qc)))))
result (if (= :elliptical-arc (:command command))
(d/concat result (arc->beziers prev-pos command))
(into result (arc->beziers prev-pos command))
(conj result command))
next-cc (case (:command orig-command)

View file

@ -304,7 +304,7 @@
[content points]
(let [segments-set (into #{}
(map (fn [{:keys [start end]}] [start end]))
(juxt :start :end)
(get-segments content points))
create-line-command (fn [point other]
@ -318,7 +318,7 @@
(flatten)
(into []))]
(d/concat content new-content)))
(into content new-content)))
(defn separate-nodes

View file

@ -630,8 +630,7 @@
(defn find-node-references [node]
(let [current (->> (find-attr-references (:attrs node)) (into #{}))
children (->> (:content node) (map find-node-references) (flatten) (into #{}))]
(-> (d/concat current children)
(vec))))
(vec (into current children))))
(defn find-def-references [defs references]
(loop [result (into #{} references)
@ -653,7 +652,7 @@
(let [node (get defs to-check)
new-refs (find-node-references node)
pending (concat pending new-refs)]
(recur (d/concat result new-refs)
(recur (into result new-refs)
(conj checked? to-check)
(first pending)
(rest pending))))))