2011/12/1 Stuart Sierra
> > Do I understand correct that the only way to hook
> > a recursive function without affecting other
> > threads is to annotate the function with
> > ^{:dynamic true} and call it via #'fact?
>
> If you want to you dynamic rebinding, yes.
>
> There are other possibilities
> Do I understand correct that the only way to hook
> a recursive function without affecting other
> threads is to annotate the function with
> ^{:dynamic true} and call it via #'fact?
If you want to you dynamic rebinding, yes.
There are other possibilities, however. Maybe you could pass the func
Thanks for the reply, Nils.
2011/12/1 Nils Bertschinger
> Hi Roman,
>
> as far as I understand, the Clojure compiler is doing some
> optimizations for recursive functions to save the variable lookup.
> This means that you have to explicitly write the recursive call as
> (#'fact (dec n)) if you w
Hi Roman,
as far as I understand, the Clojure compiler is doing some
optimizations for recursive functions to save the variable lookup.
This means that you have to explicitly write the recursive call as
(#'fact (dec n)) if you want to dynamically rebind the function.
Somehow this doesn't feel righ
Hello,
I'm trying to intercept each call to a recursive function in order to
insert logging. It works on the first invocation but not on others. What am
I missing?
(defn fact [n]
(if (< n 2)
1
(* n (fact (dec n)
; Given function f, returns another function that
; does the same as f