Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-246

Support tail recursion

    XMLWordPrintableJSON

Details

    • Wish
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 1.1-beta-2
    • None
    • class generator
    • None

    Description

      Detect and convert tail recursion into a while loop:

      #!/usr/bin/env groovy

      def my_while(test, action) {
      if (test()) action()
      else return true
      my_while(test, action)
      }

      count = 0;

      my_test = {
      return count < 1000000
      }

      my_while(my_test) {
      count++
      }

      println "made it!"

      Attachments

        Issue Links

          Activity

            People

              blackdrag Jochen Theodorou
              brianm Brian McCallister
              Votes:
              4 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: