factor/library/test/benchmark/ack.factor

20 lines
333 B
Factor
Raw Normal View History

2004-10-27 21:21:31 -04:00
USE: math
USE: kernel
USE: compiler
USE: test
! http://inferno.bell-labs.com/cm/cs/who/bwk/interps/pap.html
2004-11-08 22:36:51 -05:00
: ack ( m n -- x )
2004-10-27 21:21:31 -04:00
over 0 = [
nip 1 +
2004-10-27 21:21:31 -04:00
] [
dup 0 = [
drop 1 - 1 ack
2004-10-27 21:21:31 -04:00
] [
dupd 1 - ack >r 1 - r> ack
2004-10-27 21:21:31 -04:00
] ifte
2004-12-05 23:00:52 -05:00
] ifte ; compiled
2004-10-27 21:21:31 -04:00
[ 4093 ] [ 3 9 ack ] unit-test