Continuation of the line in APL
Is there a line continuation character in APL i.e. a character that indicates input is not yet complete and continues parsing the next line?
The reason I want is to enter an array in a format similar to its form, for example instead of:
Forecast β 4 6 β΄ 150 200 100 80 80 80 300 330 360 400 500 520 100 250 350 380 400 450 50 120 220 300 320 350
I would like to write (where \
is the hypothetical continuation character):
Forecast β 4 6 β΄ \ 150 200 100 80 80 80 \ 300 330 360 400 500 520 \ 100 250 350 380 400 450 \ 50 120 220 300 320 350
I'm using GNU APL if that's important and I'm pretty much a complete newbie, so I'm sorry if I just haven't seen it yet.
source to share
No, there is nothing like the line continuation character in any modern version of APL that I know of.
But you have a point - visual fidelity in defining arrays is important, but it has never really been considered at the language level.
I would probably do
Forecast β 4 6 β΄ 150 200 100 80 80 80, 300 330 360 400 500 520, 100 250 350 380 400 450, 50 120 220 300 320 350
or
Forecast β 0 β΄ 0
Forecast β Forecast, 150 200 100 80 80 80
Forecast β Forecast, 300 330 360 400 500 520
Forecast β Forecast, 100 250 350 380 400 450
Forecast β Forecast, 50 120 220 300 320 350
Forecast β 4 6 β΄ Forecast
when formatting is needed.
Several years ago, some versions of APL allowed you to enter character strings with inline carriage returns in functions, simply without inserting a trailing quote until you were done. This function had a similar effect, but only for lines and only for one function line. It was eventually removed from IBM APL and Sharp APL, possibly many others. Perhaps it was confusing to users who were stuck with what appeared to be an input loop, or perhaps del's own editor was unable to process such lines afterwards.
source to share
Dyalog MiServer uses a nifty command that allows the developer to include the JS code that is needed as part of the page in the APL code through the ScriptFollows function, which simply scans the lines following this statement and returns all the text from the next segment of the continuously commented lines. This idea can also be (ab-) used for your query:
β foo
β required functions need to be in the WS or can be defined here:
dtlbβ{β΅{((β¨\β΅)β§β½β¨\β½β΅)/βΊ}' 'β β΅} β delete trailing blanks
ScriptFollowsβ{{β{'β'=ββ΅:'' β ' ',dtlb β΅}Β¨1βΒ¨β΅/β¨β§\'β'=βΒ¨β΅}dtlbΒ¨(1+2ββLC)ββNR 2ββSI}
β end of initialization...
β and then could just write:
arrβ4 4β΄2ββVFI ScriptFollows β¬
β 1 2 3 4
β 5 6 7 8
β 9 10 11 12
β 13 14 15 16
β
Disadvantage: The rho of the array must be specified independently of the data, so when you need to edit the data, you have to edit in two places. Other than that, I must say that I really fell in love with this ScriptFollows
-Stuff; -)
source to share