aphyr / dom-top

Unorthodox control flow, for Clojurists with masochistic sensibilities.
Eclipse Public License 1.0
204 stars 8 forks source link

Consider increasing the masochism factor by adding support for `:let`/`:while`/`:when` to `loopr` #7

Open p-himik opened 1 year ago

p-himik commented 1 year ago

Currently I'm using net.cgrand.xforms/for for it, but feels like it has a bit more overhead than loopr would if it had support for those for sugary bits.

A slightly changed example from the docstring as a brief illustration.

(loopr [count 0
        sum   0]
       [f (range 10)
        :when (even? f)
        row [[1 2 3] [4 5 6] [7 8 9]]
        :let [column (mapv inc row)]
        x row
        y column]
  (recur (inc count) (+ sum (* f x y)))
  (/ sum count))