migrationapldyalogdialect

What is the Dyalog equivalent of the APL/360 I-beam 26?


What is the best translation from APL/360 to Dyalog for I-beam 26 for example in the lines:

→(3 2 1 ⍴⍴X)/(DFTERR+F←0), 2 3 +⌶26
→(∧/0≤Y)/2+⌶26

?

(The APL\360 manual at https://www.softwarepreservation.org/projects/apl/Books/APL360ReferenceManual says

⌶26  Current value of line counter. In the execution
         of a defined function, this is the command
         number of the command being executed. ⌶26 can
         be used for branching. For example, →2+⌶26 is a
         branch to two commands beyond the present one.

)


Solution

  • 50100⌶1

    The problem with ⎕LC is that it returns one line counter per stack frame so 2 3 +⌶26 will give a length error if the stack has more than two frames, and will give the wrong result if the stack has two frames. In contrast, 50100⌶ takes an argument which is the number of stack frames to report on (1).

    We could also write ⊃⎕LC (first of the line counter, assuming ⎕ML≤1) but 50100⌶1 is more efficient.