(defn-trampolined fn-name args & body)
Given a function body which uses trampolined-recur for recursion (instead of recur), this macro generates a function with given name.
The generated function accepts the same arguments which are passed to the macro as args parameter. The args parameter is expected to be a vector.
The macro replaces all the occurrences of trampolined-recur in function body with calls to anonymous function.
The generated function uses trampolining to achieve recursion. In other words, we swap stack for heap for recursive calls. See: https://clojuredocs.org/clojure.core/trampoline.
If the given function body does not have any trampoline-recur occurrences, the generated function body will be exactly same as passed except it will be wrapped in an anonymous function and called with trampoline.
Given a function body which uses trampolined-recur for recursion (instead of recur), this macro generates a function with given name. The generated function accepts the same arguments which are passed to the macro as args parameter. The args parameter is expected to be a vector. The macro replaces all the occurrences of trampolined-recur in function body with calls to anonymous function. The generated function uses trampolining to achieve recursion. In other words, we swap stack for heap for recursive calls. See: https://clojuredocs.org/clojure.core/trampoline. If the given function body does not have any trampoline-recur occurrences, the generated function body will be exactly same as passed except it will be wrapped in an anonymous function and called with trampoline.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close