Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: language shoot-out :-)

From: joel:neely:fedex at: 5-Nov-2002 7:15

Hi, Tom, Could you please post the code which you used to generate that output? It doesn't match what I'm getting at all! Here's my test harness ... 8<---------------------------------------------------------------------- ackermann: make object! [ curr_depth: max_depth: tot_evals: 0 ack: func [m [integer!] n [integer!] /local result] [ max_depth: max max_depth curr_depth: curr_depth + 1 tot_evals: tot_evals + 1 result: either m = 0 [ n + 1 ][ either n = 0 [ ack m - 1 1 ][ ack m - 1 ack m n - 1 ] ] curr_depth: curr_depth - 1 result ] run: func [][ repeat i 8 [ curr_depth: max_depth: tot_evals: 0 if error? try [ print [i ack 3 i max_depth tot_evals] ][ print [ "Failure at depth" curr_depth "/" max_depth "after" tot_evals ] ] ] ] ] 8<---------------------------------------------------------------------- ... and I get these results ...
>> ackermann/run
1 13 15 106 2 29 31 541 3 61 63 2432 4 125 127 10307 5 253 255 42438 6 509 511 172233 Failure at depth 709 / 709 after 250362 Failure at depth 709 / 709 after 249577 (on w95, but YMMVDOP!) -jn- Tom Conlin wrote:
> I would geuss ack 3 7 blows up close to where ack 3 8 does > > %ack 3 8 > ... > 323990 > 323991 > 323992 > 323993 > 323994 > 323995 > ** Internal Error: Stack overflow > ** Near: ack (x - 1) 1 > > On Mon, 4 Nov 2002, Carl at REBOL wrote: > > > How deep is the stack at 7? > >
-- ; Joel Neely joeldotneelyatfedexdotcom REBOL [] do [ do func [s] [ foreach [a b] s [prin b] ] sort/skip do function [s] [t] [ t: "" foreach [a b] s [repend t [b a]] t ] { | e s m!zauafBpcvekexEohthjJakwLrngohOqrlryRnsctdtiub} 2 ]