alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

Groovy example source code file (ackermann.java)

This example Groovy source code file (ackermann.java) 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

ack, ack

The Groovy ackermann.java source code

// $Id: ackermann.java,v 1.2 2005-05-13 16:24:17 igouy-guest Exp $
// http://www.bagley.org/~doug/shootout/ 

public class ackermann {
    public static void main(String[] args) {
	int num = Integer.parseInt(args[0]);
	System.out.println("Ack(3," + num + "): " + Ack(3, num));
    }
    public static int Ack(int m, int n) {
	return (m == 0) ? (n + 1) : ((n == 0) ? Ack(m-1, 1) :
				     Ack(m-1, Ack(m, n - 1)));
    }
}

Other Groovy examples (source code examples)

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

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 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.