Now that I get into it, I think the system was working properly and the
documentation needed improving. I have modified the description of Cut
Stack in NuVoc.
The problem was a sentence like
z =. z , foo y
where foo, which always produces a list normally, took an error for a
certain y. The user (Raul) executed Cut Stack (13!:19) in foo to pick
up again in the caller, but at that point the rank of z became 2, and
things went downhill, because the code relies on z's being a list.
WHAT HAPPENED was that Cut Stack terminates the top-of-stack execution,
and picks up in the caller at the point of interruption. But that point
of interruption is in the middle of an executing sentence, and the only
way to resume is to set the system running at the point of the call,
that is in the middle of the sentence at the return from the call. To
do that some value must be provided as the result of the call. The
system uses (i. 0 0) as that value. Thus, at the end of Cut Back in
this case, z gets rank 2. This is the way the system was designed to work.
I think perhaps Cut Stack should take an argument to be used as the
return value, or have a way to produce an error, but that's a problem
for another day (if someone would like to add this to the issues list).
I think it might have been possible to figure out this behavior from the
previous NuVoc entry, but I have rewritten that entry to make it clear
that the caller's interrupted sentence is executed twice, once with a
(i. 0 0) value.
Henry Rich
On 6/16/2022 2:00 PM, Raul Miller wrote:
On Thu, Jun 16, 2022 at 1:58 PM Henry Rich <[email protected]> wrote:
I think we are agreeing that the problem is that Cut Back is using an
invalid result from the failing function to finish the sentence in the
caller.
Yes, that's what it looks like.
Thanks,
--
This email has been checked for viruses by AVG.
https://www.avg.com
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm