jsoftware / jsource

J engine source mirror
Other
645 stars 91 forks source link

13!:19 inconsistencies #131

Closed rdm closed 2 years ago

rdm commented 2 years ago

Currently, the j engine has some cases where 13!:19 is handled inconsistently. Perhaps the jqt debugger has some workarounds in place for some of these, but these workarounds are insufficient.

For example:

example1=: {{
  i=. i.y
  i problem each i
  echo 'fail'
}}

problem=: {{
  1 2+3 4 5
}}

example2=: {{
  j=. p:i.y
  example1 y
}}

Here, we wish to run example2 10 under the debugger, and we wish to inspect the values of i and j.

Oddly, the "cut back the stack" behavior under the jqt debugger is different from the use of 13!:19]1 at the command line. Since the command line is more fundamental, let's focus on that:

      13!:0]0

   13!:0]1
   example2 10
|domain error: problem
|problem[:0]
      13!:19]1
|domain error: example1
|       13!:19]1
      i
0 1 2 3 4 5 6 7 8 9
      13!:19]1
|domain error
|       13!:19]1
      j
|value error: j

Now... it may be that there are Very Good Reasons for this current behavior. But, if that is the case, we should have some other mechanism available to us to allow us to inspect j which does not depend on the example value of y (which may be a large value).

HenryHRich commented 2 years ago

13!:19 y requires that y can be converted to a string