3 ms·
This is exciting. I'm guessing since it applies to bytecode it works for clojure as well? That would mean we'll be able to use (func (when cond function)) inste
by Gollapalli 6y ago
This is exciting. I'm guessing since it applies to bytecode it works for clojure as well? That would mean we'll be able to use (func (when cond function)) instead of (loop [] (recur)).
- sipkab 6y agoIt works on bytecode, so yes, it should apply to all JVM based languages. (Though I haven't done tests for them)
- hencq 6y agoThe use of recur in Clojure is by design. It would have been quite trivial to optimize this type of self recursion, but since it doesn't do general tail call optimization, they introduced the recur keyword. See also [1]. By the way, you don't need to use loop in Clojure either, it also works with functions. [1]. https://clojure.org/about/functional_programming#_recursive_looping https://clojure.org/about/functional_programming#_recursive_...
- Scarbutt 6y agoThis library just does self-calls, doesn't optimize(and can't cause of JVM limitations) calls to others functions (mutual recursion).