Provide a Groovy AST transformation to convert tail recursive methods into iterative ones
Groovy Shell
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
gradle/wrapper
src
.gitignore
License.md
README.md
build.gradle
gradlew
gradlew.bat
settings.gradle
todo.txt

README.md

TailRecursion

This project adds a @TailRecursive annotation for Groovy methods.

Starting with Groovy 2.3 it will be incorporated into Groovy's core library.

For now, have a look at my blogpost which explains the reasoning behind tailrec and gives you an example. But beware the pachage names have changed, the annotation now is groovy.transform.TailRecursive

If you are on Groovy 2.2.1 (or a similar version) you can try out tail recursions using prerelease 0.6.

Download the sourcecode to find examples in

  • org.codehaus.groovy.transform.tailrec.TailRecursiveExamples.groovy
  • org.codehaus.groovy.transform.tailrec.RecursiveListExamples.groovy