问题
How to code a multi-line text value in Dyalog APL?
I want to code something like this:
query←'
SELECT *
FROM SOME_TABLE
'
to be able to copy this text to SQL Developer and back.
I know that I could code it this way:
query←''
query,←'SELECT * '
query,←'FROM SOME_TABLE '
But it would not allow me to copy this text to SQL Developer and back easily.
Is it possible to temporary override the newline character in Dyalog APL function source code?
回答1:
S←{a←⍺⍺⋄,⎕cr'a'}
query←{
SELECT *
FROM Some_Table
}S⍬
回答2:
I'm afraid Multiline-Strings aren't there (yet, I hope).
The only way around this would be do write it as follows:
query←ScriptFollows
⍝ SELECT *
⍝ FROM Some_Table
When pasting from SQL Dev, select the inserted text and click the ⍝ button on the editor toolbar to insert the comment symbol on each line.
If using the IDE, click and hold the right mouse button to select a rectangular block without the comment symbols.
回答3:
This feature was actually available many years ago on (mainframe) systems based on APL\360, such as Sharp APL (removed around 1980?), STSC APL*Plus, and others. Among other things, it was no longer possible to go back edit such a line with embedded carriage returns with the normal del editor (full screen editors, as such, did not exist yet). It was removed as it may have been confusing for users - the system expected a closing quote and just pressing return did not implicitly provide one.
来源:https://stackoverflow.com/questions/42955675/multi-line-text-values-in-dyalog-apl