Closed bernecky closed 3 years ago
Also, I want to be able to add all the elements of a folder F by doing:
]add F
or something along those lines
So, I discovered ⎕se.Link. It doesn't work so hot if you make a typo:
)cs fragments
#.sac.fragments
⎕this
#.sac.fragments
⎕SE.Link.add ⎕NL 2
VALUE ERROR: Undefined name: add
⎕SE.Link.add ⎕NL 2
∧
⎕this
#.sac
I don't remember why there's this restriction, but meanwhile, simply use ⎕SE.Link.Add 'this' 'that' 'them'
.
I'm not sure what you mean by adding all the elements of a folder. You're using Add, which means you're on the APL side of the linkage, and APL doesn't have "folders". Do you mean to add a namespace that you've created? That should work. If it doesn't, then please log a separate issue for that. If instead you mean to add all the members of a particular namespace, then maybe ⎕CS F ⋄ ⎕SE.Link.Add ⎕NL-⍳9
might help.
Yes, APL code is case-sensitive, similar to how Linux deals with file names. On the other hand, both system commands and user commands have always been case insensitive, similar to how Windows deals with file names.
Was this a good design? Maybe not. But it was made many decades ago, and would b difficult to change at this point.
Add only likes vectors, it seems, and not even all of them. Rank to the rescue, of course!
⎕se.Link.Add (,' ',⎕NL 2)
Not found: #.sac.fragments.TEMPcatlamTEMPcommandlineTEMPcutTEMPdadverbsTEMPdconjTEMPdgradeTEMPdmiscTEMPdscalarTEMPdsfctlTEMPds
tructTEMPepioTEMPindrTEMPindsTEMPjotdotTEMPmadverbsTEMPmconjTEMPmdrankTEMPmgradeTEMPmmiscTEMPmscalarTEMPmsfctlTEMPmstruc
tTEMPquadfiTEMPqueryTEMPquotequadTEMPreplicateTEMPreshapeTEMPscanTEMPsysfnsniladicTEMPtakedropTEMPthornTEMPutilities
⎕se.Link.Add ⎕NL 2
Not found: #.sac.fragments.TEMPcatlamTEMPcommandlineTEMPcutTEMPdadverbsTEMPdconjTEMPdgradeTEMPdmiscTEMPdscalarTEMPdsfctlTEMPds
tructTEMPepioTEMPindrTEMPindsTEMPjotdotTEMPmadverbsTEMPmconjTEMPmdrankTEMPmgradeTEMPmmiscTEMPmscalarTEMPmsfctlTEMPmstruc
tTEMPquadfiTEMPqueryTEMPquotequadTEMPreplicateTEMPreshapeTEMPscanTEMPsysfnsniladicTEMPtakedropTEMPthornTE
⎕se.Link.Add⍤1⊣ ⎕NL 2
Added: #.sac.fragments.TEMPcatlam
Added: #.sac.fragments.TEMPcommandline
...
Are you aware of ⎕NL
with negative numbers? If one or more of the argument elements is negative, then ⎕NL
returns a vector of character vectors. That said, we should probably always accept a name matrix in place of a name list.
The API docn for ]link.add refers to something called an "items". What is it, and where is "items" defined? Being precise, rather than vague, is important in technical writing, as it saves time for both the author AND the user.
Are you aware that the above code example failures change the current namespace? I do prefer case sensitivity, but it should not come at the cost of changing the execution environment without warning.
Life is too short to remember ill-designed things like ⎕nl with negative numbers.
)clear
clear ws
)ns sac.fragments
#.sac.fragments
)cs sac.fragments
#.sac.fragments
⎕this
#.sac.fragments
⎕SE.Link.add ⎕NL 2
VALUE ERROR: Undefined name: add
⎕SE.Link.add ⎕NL 2
∧
⎕this
#.sac.fragments
↓
? With it, ↓⎕NL 2
should give you a vector of names (though with trailing spaces, of course).Re the above unannounced namespace change, it looks worse than I thought:
)cs fragments
#.sac.fragments
⎕this
#.sac.fragments
⍴xx
32 17
⍴yy
34 13
xx,yy
LENGTH ERROR
xx,yy
∧
⎕this
#.sac
This workspace does not use ⎕trap, so I find this behavior a trifle odd. Ideas welcome. I'll delve further, meanwhile.
This is clearly not a Link issue. If you can write a complete repro of the issue starting with a clear workspace, then please email that to support@dyalog.com ― don't forget to include the output from ]version
⎕SE.Link.Add does work with multiple names. However I agree with Bob that ]link.add should allow multiple names too.
While I tend to dislike special cases, maybe handing ]add ⎕NL
followed by an expression consisting of the characters ¯-0123456789.⍳
would be a good idea. Note that no APL name can ever consist entirely of those characters, so this doesn't block anything.
Fixed in link v2.1.0-beta26:
Please report one bug per issue. Here you have reported several.
Life is too short for: ]add this ]add that ]add them
I want: ]add this that them