Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
26
Task/Ackermann-function/FutureBasic/ackermann-function.basic
Normal file
26
Task/Ackermann-function/FutureBasic/ackermann-function.basic
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
include "NSLog.incl"
|
||||
|
||||
local fn Ackerman( m as NSInteger, n as NSInteger ) as NSInteger
|
||||
NSInteger result
|
||||
|
||||
select
|
||||
case m == 0 : result = ( n + 1 )
|
||||
case n == 0 : result = fn Ackerman( ( m - 1 ), 1 )
|
||||
case else : result = fn Ackerman( ( m - 1 ), fn Ackerman( m, ( n - 1 ) ) )
|
||||
end select
|
||||
end fn = result
|
||||
|
||||
NSInteger m, n
|
||||
CFMutableStringRef mutStr
|
||||
|
||||
mutStr = fn StringWithCapacity( 0 )
|
||||
|
||||
for m = 0 to 3
|
||||
for n = 0 to 9
|
||||
StringAppendString( mutStr, fn StringWithFormat( @"fn Ackerman( %ld, %ld ) = %ld\n", m, n, fn Ackerman( m, n ) ) )
|
||||
next
|
||||
next
|
||||
|
||||
NSLog( @"%@", mutStr )
|
||||
|
||||
HandleEvents
|
||||
Loading…
Add table
Add a link
Reference in a new issue