(ensure-within-beta-limit state & [err-f])(fake-seq-invoke seq-args env)(find-matching-method ast nargs)(make-invoke-expr the-fn args env)(make-var-expr var env)(maybe-beta-reduce-apply {:keys [env] :as ufn}
args
&
[{:keys [before-reduce] :as opts}])(maybe-beta-reduce-fn ufn args & [{:keys [before-reduce] :as opts}])(push-invoke state {:keys [op] :as ast})Push arguments into the function position of an :invoke so the function and arguments are both in the same :invoke node, then reanalyze the resulting :invoke node.
eg. ((let [a 1] identity) 2) ;=> (let [a 1] (identity 2)) eg. ((if c identity first) [1]) ;=> (if c (identity [1]) (first [1]))
Push arguments into the function position of an :invoke
so the function and arguments are both in the
same :invoke node, then reanalyze the resulting :invoke node.
eg. ((let [a 1] identity) 2)
;=> (let [a 1] (identity 2))
eg. ((if c identity first) [1])
;=> (if c (identity [1]) (first [1]))
(reached-beta-limit? state)(record-beta-reduction state)(splice-seqable-expr {:keys [op env] :as ast})If ast is a seqable, returns a vector describing its members. Otherwise nil.
:ordered entry is true if calling first on this expr is ordered
eg. (vector 1 2 3) [{:op :sequential :expr (vector 1 2 3) :min-count 3 :max-count 3}]
eg. (cons 4 (vector 1 2 3)) [{:op :single :expr 4} {:op :sequential :expr (vector 1 2 3) :min-count 3 :max-count}]
eg. (concat (vector 1 2 3) (range 0)) [{:op :sequential :expr (vector 1 2 3) :min-count 3 :max-count 3} {:op :sequential :expr (range 0) :min-count ##Inf :max-count ##Inf}]
eg. (concat (vector 1 2 3) (range 0) (vector 1 2 3)) [{:op :sequential :expr (vector 1 2 3) :min-count 3 :max-count 3} {:op :sequential :expr (range 0) :min-count ##Inf :max-count ##Inf} {:op :sequential :expr (vector 1 2 3) :min-count 3 :max-count 3}]
eg. (range 0) [{:op :sequential :expr (range 0) :min-count ##Inf :max-count ##Inf}]
eg. (range 0 39) [{:op :sequential :expr (range 0 39) :min-count 39 :max-count 39}]
eg. nil [{:op :sequential :expr nil :min-count 0 :max-count 0}]
eg. (take-while symbol? (read-string)) [{:op :sequential :expr (take-while symbol? (read)) :min-count 0 :max-count ##Inf}]
eg. {:a 1 :b 2} [{:op :unordered :expr {:a 1 :b 2} :min-count 2 :max-count 2}]
eg. #{:a :b} [{:op :unordered :expr #{:a :b} :min-count 2 :max-count 2}]
If ast is a seqable, returns a vector describing its members. Otherwise nil.
:ordered entry is true if calling `first` on this expr is ordered
eg. (vector 1 2 3)
[{:op :sequential :expr (vector 1 2 3) :min-count 3 :max-count 3}]
eg. (cons 4 (vector 1 2 3))
[{:op :single :expr 4}
{:op :sequential :expr (vector 1 2 3) :min-count 3 :max-count}]
eg. (concat (vector 1 2 3) (range 0))
[{:op :sequential :expr (vector 1 2 3) :min-count 3 :max-count 3}
{:op :sequential :expr (range 0) :min-count ##Inf :max-count ##Inf}]
eg. (concat (vector 1 2 3) (range 0) (vector 1 2 3))
[{:op :sequential :expr (vector 1 2 3) :min-count 3 :max-count 3}
{:op :sequential :expr (range 0) :min-count ##Inf :max-count ##Inf}
{:op :sequential :expr (vector 1 2 3) :min-count 3 :max-count 3}]
eg. (range 0)
[{:op :sequential :expr (range 0) :min-count ##Inf :max-count ##Inf}]
eg. (range 0 39)
[{:op :sequential :expr (range 0 39) :min-count 39 :max-count 39}]
eg. nil
[{:op :sequential :expr nil :min-count 0 :max-count 0}]
eg. (take-while symbol? (read-string))
[{:op :sequential :expr (take-while symbol? (read)) :min-count 0 :max-count ##Inf}]
eg. {:a 1 :b 2}
[{:op :unordered :expr {:a 1 :b 2} :min-count 2 :max-count 2}]
eg. #{:a :b}
[{:op :unordered :expr #{:a :b} :min-count 2 :max-count 2}]
(subst-locals ast subst)(unwrap-with-meta ast)(var->vsym v)(visit-tail-pos ast f)cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |