Skip to content

Commit

Permalink
Merge remote-tracking branch 'mpevnev/avoid-lazy-concat-in-select' in…
Browse files Browse the repository at this point in the history
…to stack
  • Loading branch information
ajoberstar committed Aug 14, 2022
2 parents 9d891a8 + 1d3e723 commit 32a98bf
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions src/main/clojure/dev/clojurephant/jovial/engine.clj
Original file line number Diff line number Diff line change
Expand Up @@ -128,13 +128,7 @@
(defn select [^EngineDiscoveryRequest request ^UniqueId id]
(let [listener (.getDiscoveryListener request)
selectors (.getSelectorsByType request DiscoverySelector)]
(loop [result []
head (first selectors)
tail (rest selectors)]
(let [candidates (try-select listener id head)]
(if (seq tail)
(recur (concat result candidates) (first tail) (rest tail))
(concat result candidates))))))
(reduce #(into %1 (try-select listener id %2)) [] selectors)))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Discovery Descriptor Support
Expand Down

0 comments on commit 32a98bf

Please sign in to comment.