home | career | drupal | java | mac | mysql | perl | scala | uml | unix

Groovy example source code file (ackermann.groovy)

This example Groovy source code file (ackermann.groovy) is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Java - Groovy tags/keywords

a, a, ack, ack

The Groovy ackermann.groovy source code

The Computer Language Shootout

contributed by Jochen Hinrichsen

def A(x, y) {
   // TODO: return statement is stated optional, but does not work w/o
   if (x == 0) return y+1
   if (y == 0) return A(x-1, 1)
   return A(x-1, A(x, y-1))

def n = this.args[0].toInteger()
def result = A(3, n)
println("Ack(3,${n}): ${result}")

Other Groovy examples (source code examples)

Here is a short list of links related to this Groovy ackermann.groovy source code file:

new blog posts


Copyright 1998-2014 Alvin Alexander, alvinalexander.com
All Rights Reserved.