|
Groovy example source code file (ackermann.groovy)
The Groovy ackermann.groovy source code/* The Computer Language Shootout http://shootout.alioth.debian.org/ 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: |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.