Liking cljdoc? Tell your friends :D

faconne.parse-range


build-clauses-from-rangeclj/s

(build-clauses-from-range domain-bound-symbols range result-sym)

The strategy: In general, maintain a volatile reference to the result.

If the range is a vector/set, the result will be a transient []/#{}. At each leaf, evaluate the range and 'vswap! into!' it into the maintained result. At the end of the fn, just call persistent! on the result. You might think the volatile ref is extraneous since we're using transients, but fns like conj! are meant to be used for the result they return, not for their side-effects. (This caused a weird bug.)

If the range is a map, then the result is a persistent map. Initially, I had created functions like assoc-in! and update-in! that worked on nested map transients, but found that these were actually slower than just merging a bunch of small persistent maps together. I'm not really sure why this was the case. Anyway, at each leaf, evaluate the range and deep merge it into the result. At the end, just return the result.

The strategy: In general, maintain a volatile reference to the result.

If the range is a vector/set, the result will be a transient []/#{}.
At each leaf, evaluate the range and 'vswap! into!' it into the maintained result.
At the end of the fn, just call persistent! on the result.
You might think the volatile ref is extraneous since we're using transients, but
fns like `conj!` are meant to be used for the result they return, not for their side-effects.
(This caused a weird bug.)

If the range is a map, then the result is a persistent
map. Initially, I had created functions like assoc-in! and
update-in! that worked on nested map transients, but found that
these were actually slower than just merging a bunch of small
persistent maps together. I'm not really sure why this was the
case. Anyway, at each leaf, evaluate the range and deep merge it
into the result. At the end, just return the result. 
sourceraw docstring

build-reducerclj/s

(build-reducer substructures form)
source

child-formsclj/s

(child-forms form)
source

convert-range-to-reducableclj/s

(convert-range-to-reducable domain-bound-symbols form)
source

deep-mergeclj/s

(deep-merge x y)
source

eval-reduce-dataclj/s

(eval-reduce-data reduce-data)

Now that the reducedata's substructures are fully built, apply the reducing functions to them.

Now that the reducedata's substructures are fully built, apply
the reducing functions to them.
sourceraw docstring

into!clj/smacro

(into! coll xs)
source (clj)source (cljs)

make-reduce-dataclj/s

(make-reduce-data reducefn data type)
source

reducable-substructuresclj/s

(reducable-substructures domain-bound-symbols form)

Find the topmost child forms that use collections built in the transform.

For example, if we have (max (apply max [g1]) (apply max [g2])) and both g1 and g2 are domain-bound, then this returns [[g1] [g2]].

By replacing these substructures with gensyms, we get the reducing fn: (fn [g1-sym g2-sym] (max (apply max g1-sym) (apply max g2-sym)))

(see build-reducer).

Find the topmost child forms that use collections built in the transform.

For example, if we have (max (apply max [g1]) (apply max [g2])) and both
g1 and g2 are domain-bound, then this returns
[[g1] [g2]].

By replacing these substructures with gensyms, we get the reducing fn:
(fn [g1-sym g2-sym] (max (apply max g1-sym) (apply max g2-sym)))

(see build-reducer).
sourceraw docstring

reducedata?clj/s

(reducedata? x)
source

requires-reducing-logic?clj/s

(requires-reducing-logic? domain-bound-symbols form)
source

spyclj/s

(spy x)
source

uses-symbol?clj/s

(uses-symbol? domain-bound-symbols form)
source

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close