Home » Archimedes archive » Zipped Apps » FORTH » !FORTH/TestProgs/acker

!FORTH/TestProgs/acker

This website contains an archive of files for the Acorn Electron, BBC Micro, Acorn Archimedes, Commodore 16 and Commodore 64 computers, which Dominic Ford has rescued from his private collection of floppy disks and cassettes.

Some of these files were originally commercial releases in the 1980s and 1990s, but they are now widely available online. I assume that copyright over them is no longer being asserted. If you own the copyright and would like files to be removed, please contact me.

Tape/disk: Home » Archimedes archive » Zipped Apps » FORTH
Filename: !FORTH/TestProgs/acker
Read OK:
File size: 01F5 bytes
Load address: 0000
Exec address: 0000
File contents
CORE
: ackerman 
    OVER
    IF
       DUP
       IF
          1- OVER 1- LROT ackerman ackerman
       ELSE
          DROP 1- 1 ackerman
       ENDIF
    ELSE
       + 1+
    ENDIF ;
0 VARIABLE print_mode
: time PRINT_MODE @ DUP print_mode ! 1 OR PRINT_MODE ! CRET DUP 2OVER ." ackerman(" . ." ," . ." ) = " 
       TIME LROT ackerman SWAP TIME SWAP - SWAP .
       ." ,   Time taken = " . ."  centi-seconds"print_mode @ PRINT_MODE ! ;
3 2 time
3 3 time
3 4 time
3 5 time
3 6 time
3 7 time
3 8 time
00000000  43 4f 52 45 0a 3a 20 61  63 6b 65 72 6d 61 6e 20  |CORE.: ackerman |
00000010  0a 20 20 20 20 4f 56 45  52 0a 20 20 20 20 49 46  |.    OVER.    IF|
00000020  0a 20 20 20 20 20 20 20  44 55 50 0a 20 20 20 20  |.       DUP.    |
00000030  20 20 20 49 46 0a 20 20  20 20 20 20 20 20 20 20  |   IF.          |
00000040  31 2d 20 4f 56 45 52 20  31 2d 20 4c 52 4f 54 20  |1- OVER 1- LROT |
00000050  61 63 6b 65 72 6d 61 6e  20 61 63 6b 65 72 6d 61  |ackerman ackerma|
00000060  6e 0a 20 20 20 20 20 20  20 45 4c 53 45 0a 20 20  |n.       ELSE.  |
00000070  20 20 20 20 20 20 20 20  44 52 4f 50 20 31 2d 20  |        DROP 1- |
00000080  31 20 61 63 6b 65 72 6d  61 6e 0a 20 20 20 20 20  |1 ackerman.     |
00000090  20 20 45 4e 44 49 46 0a  20 20 20 20 45 4c 53 45  |  ENDIF.    ELSE|
000000a0  0a 20 20 20 20 20 20 20  2b 20 31 2b 0a 20 20 20  |.       + 1+.   |
000000b0  20 45 4e 44 49 46 20 3b  0a 30 20 56 41 52 49 41  | ENDIF ;.0 VARIA|
000000c0  42 4c 45 20 70 72 69 6e  74 5f 6d 6f 64 65 0a 3a  |BLE print_mode.:|
000000d0  20 74 69 6d 65 20 50 52  49 4e 54 5f 4d 4f 44 45  | time PRINT_MODE|
000000e0  20 40 20 44 55 50 20 70  72 69 6e 74 5f 6d 6f 64  | @ DUP print_mod|
000000f0  65 20 21 20 31 20 4f 52  20 50 52 49 4e 54 5f 4d  |e ! 1 OR PRINT_M|
00000100  4f 44 45 20 21 20 43 52  45 54 20 44 55 50 20 32  |ODE ! CRET DUP 2|
00000110  4f 56 45 52 20 2e 22 20  61 63 6b 65 72 6d 61 6e  |OVER ." ackerman|
00000120  28 22 20 2e 20 2e 22 20  2c 22 20 2e 20 2e 22 20  |(" . ." ," . ." |
00000130  29 20 3d 20 22 20 0a 20  20 20 20 20 20 20 54 49  |) = " .       TI|
00000140  4d 45 20 4c 52 4f 54 20  61 63 6b 65 72 6d 61 6e  |ME LROT ackerman|
00000150  20 53 57 41 50 20 54 49  4d 45 20 53 57 41 50 20  | SWAP TIME SWAP |
00000160  2d 20 53 57 41 50 20 2e  0a 20 20 20 20 20 20 20  |- SWAP ..       |
00000170  2e 22 20 2c 20 20 20 54  69 6d 65 20 74 61 6b 65  |." ,   Time take|
00000180  6e 20 3d 20 22 20 2e 20  2e 22 20 20 63 65 6e 74  |n = " . ."  cent|
00000190  69 2d 73 65 63 6f 6e 64  73 22 70 72 69 6e 74 5f  |i-seconds"print_|
000001a0  6d 6f 64 65 20 40 20 50  52 49 4e 54 5f 4d 4f 44  |mode @ PRINT_MOD|
000001b0  45 20 21 20 3b 0a 33 20  32 20 74 69 6d 65 0a 33  |E ! ;.3 2 time.3|
000001c0  20 33 20 74 69 6d 65 0a  33 20 34 20 74 69 6d 65  | 3 time.3 4 time|
000001d0  0a 33 20 35 20 74 69 6d  65 0a 33 20 36 20 74 69  |.3 5 time.3 6 ti|
000001e0  6d 65 0a 33 20 37 20 74  69 6d 65 0a 33 20 38 20  |me.3 7 time.3 8 |
000001f0  74 69 6d 65 0a                                    |time.|
000001f5