My guess about the internals is that a stack frame is created every time 
something executes.

In $:@:>: :: ] 0
you have

::   (i. e. $:@:>: :: ] )

@:   (i. e. $:@:>: )

$:

::

etc repeated.  3 frames per recursion, which suggests a stack limit of 
about 6666*3=20000.

In foo=. 3 : 'foo :: ]>:y'

you have

::

foo

::

etc.  2 frames per recursion, 9999*2=20000

In $:@:>:@<:@>: :: ] you have :: @: @ @ $:, 5 frames.

$:@:(1&+) :: ] 0 is interesting.  Apparently the stack frames for (1&+) 
are not popped when that verb finishes.  I wonder why.

Henry Rich

On 1/26/2011 5:36 PM, Roger Hui wrote:
> Different expressions use up differing levels of the C stack:
>
>     $:@:>: :: ] 0
> 6666
>     $:@:(1&+) :: ] 0
> 4999
>     $:@:>:@<:@>: :: ] 0
> 3999
>
>
>
> ----- Original Message -----
> From: Dan Bron<[email protected]>
> Date: Wednesday, January 26, 2011 13:43
> Subject: Re: [Jprogramming] identifying the calling function
> To: 'Programming forum'<[email protected]>
>
>> Thomas Costigliola asked:
>>> What do you make of this:
>>>
>>>      $:@:>: :: ] 0
>>> 6666
>>>      foo=. 3 : 'foo :: ]>:y'
>>>      foo 0
>>> 9999
>>
>> Interesting observation!  I'm not sure what to make of
>> it.
>>
>> Maybe J manages the explicit stack manually?  That makes
>> sense for a number
>> of reasons (e.g. 13!:13).  If so, then the two stacks which
>> are managed
>> independently might have independent limits.  But then,
>> what's with this
>> factor of 3333?
>>
>> Maybe Roger or Henry have insight.
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to