The Ackermann benchmark is misleading. Ack made use of later results in the essay that you cited, results derived using the much simpler ack . >From the same results, one could define:
a0=: >: a1=: 2&+ a2=: 3&+@(2&*) a3=: 2&^&.(3&+) a4=: ^/@(#&2)&.(3&+) " 0 a5=: 3 : '^/@(#&2)^:(1+y)&.(3&+) 1' :: _: " 0 ackk=: ([EMAIL PROTECTED])`([EMAIL PROTECTED])`([EMAIL PROTECTED])`([EMAIL PROTECTED])`([EMAIL PROTECTED])`([EMAIL PROTECTED])`(_"0) @. [ And then, comparing apples to apples: (ackk"0 _~ -: Ack"0 _~) 0 1 2 3 1 (ackk"0 _~ -: Ack"0 _~) i.7 1 ts 'Ack"0 _~ 0 1 2 3' 8.99162e_5 3712 ts 'ackk"0 _~ 0 1 2 3' 3.20388e_5 3392 ts 'Ack"0 _~ i.7' 1.36114 19904 ts 'ackk"0 _~ i.7' 0.141217 531776 Regarding Ack. As a courtesy to the reader, one could define it using components with little if any loss in efficiency. And if you did define it using components but posted to the forum the result of applying f. , you have even less excuse. f03 =: {::&(<;._1 ' >: 2&+&.(3&+) 2&*&.(3&+) 2&^&.(3&+)') fx =: '-&3@:(] (' , ] , ')&.(-&3)@:]^:(>:@:[)4:)'"_ f4n =: ] fx^:([-3:) [EMAIL PROTECTED]: Ack1=: (f03 :: f4n)@[ 128!:2 ] (Ack1"0 _~ -: Ack"0 _~) i.7 1 ts 'Ack1"0 _~ i.7' 1.36694 19904 -------------------------------------- >From Jose Mario Quintana <[EMAIL PROTECTED]> Sent Tuesday, February 27, 2007 2:56 pm To 'Programming forum' <programming@jsoftware.com> Subject RE: [Jprogramming] Re: Function-level programming .... You can find an example of this approach in http://www.jsoftware.com/pipermail/general/2006-January/026196.html (find Ackermann close to the end of the message). ( By the way, one can see that Ack=. (0&({::) {:: 1&({::)) ::(0&({::) ('-&3@:(] ('"_ , ] , ')&.(-&3)@:]^:(>:@:[)4:)'"_)@:]^:([ - 3:) _1: {::1&({::))@:(<@(<;._1@('`'&,)@('>:`(2&+&.(3&+))`(2&*&.(3&+))`(2&^&.(3&+))'" _))1} ])@:('.'&(] , ;:@:[)@:<)@[ 128!:2 ] is verbose relative to ( http://www.jsoftware.com/jwiki/Essays/Ackermann%27s_Function ), ack=: c1`c1`c2`c3 @. (#.@(,&*)) c1=: >:@] NB. if 0=x, 1+y c2=: <:@[ ack 1: NB. if 0=y, (x-1) ack 1 c3=: <:@[ ack [ ack <:@] NB. else, (x-1) ack x ack y-1 However, although both might be calculating the same output, ack"0 _/~ 0 1 2 3 1 2 3 4 2 3 4 5 3 5 7 9 5 13 29 61 Ack"0 _/~ 0 1 2 3 1 2 3 4 2 3 4 5 3 5 7 9 5 13 29 61 their methods are quite different, ts'ack"0 _/~ 0 1 2 3' 0.0633287192 19776 ts'Ack"0 _/~ 0 1 2 3' 0.000315403215 4288 ts'ack"0 _/~ 0 1 2 3 4' |stack error: c1 ts'Ack"0 _/~ 0 1 2 3 4' 0.00040088894 9088 ts'Ack"0 _/~ 0 1 2 3 4 5 6' 4.78145155 20544 Ack"0 _/~ 0 1 2 3 4 5 6 1 2 3 4 5 6 7 2 3 4 5 6 7 8 3 5 7 9 11 13 15 5 13 29 61 125 253 509 13 65533 _ _ _ _ _ 65533 _ _ _ _ _ _ _ _ _ _ _ _ _ ) ... ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm