Fork me on GitHub
#core-async
<
2016-04-08
>
genRaiy20:04:58

@angusiguess: did you post the link to the post? I missed it so would appreciate the link (I asked here a while ago and the only facilities exist in Clojurescript not clojure proper)

royalaid23:04:59

Curious if anyone can explain why there is a (constantly (delay x)) in http://stackoverflow.com/a/18779688/1868456

angusiguess23:04:38

@royalaid: So alter-var-root doesn’t just take a symbol and a value, it takes a symbol and a function, which when applied to the value, returns the new value.

angusiguess23:04:44

The constantly wraps the replacement executor with a function that takes any number of arguments and just returns the executor, which is what’s bound to the executor var.

angusiguess23:04:09

If you don’t use constantly, it tries to apply the delayed function to the existing value, which breaks.