misc/vim: inform the user when no results are found
[nit.git] / examples / rosettacode / ackermann_function.nit
1 #!/usr/bin/env nit
2 #
3 # This file is part of NIT ( http://www.nitlanguage.org ).
4 # This program is public domain
5
6 # Task: Ackermann function
7 # SEE: <http://rosettacode.org/wiki/Ackermann_function>
8 #
9 # A simple straightforward recursive implementation.
10 module ackermann_function
11
12 fun ack(m, n: Int): Int
13 do
14 if m == 0 then return n + 1
15 if n == 0 then return ack(m-1,1)
16 return ack(m-1, ack(m, n-1))
17 end
18
19 for m in [0..3] do
20 for n in [0..6] do
21 print ack(m,n)
22 end
23 print ""
24 end