|
From: | Elias Mårtenson |
Subject: | Re: [Bug-apl] Filter fns with ⍙ (delta-underbar) in the name by default? |
Date: | Thu, 10 Jul 2014 18:05:47 +0800 |
Hi,
as to opinions, I believe I don't like that either.
Please remember that we have user-defined commands now, so you can easily
create your own commands that do things in the way you prefer.
/// Jürgen
On 07/10/2014 03:43 AM, David B. Lamkins wrote:
Personally, I'm not a fan of having tools codify what's essential a
stylistic convention.
Looking at it another way: This is something I call the "principle of
least surprise... An experienced APL programmer shouldn't have to be
told that )FNS, )OPS and )VARS all have a hidden feature that must be
explicitly disabled to obtain the expected (and standard) behavior.
That said: This is something that's easy to do in APL without changing
the underlying platform. Here are a couple of functions that you could
use as a starting point:
∇z←⍙class ni ⍙set
⍝ Return a character array of every workspace name which includes
⍝ all characters in ⍙set. The empty set matches everything. The
⍝ optional ⍙class argument selects results by name class; the
⍝ default is 2 3 4 (variables, functions and operators).
⍎(0=⎕nc '⍙class')/'⍙class←2 3 4'
z←⊃{ (∧/⊃(⊂,⍙set)∊¨⍵)/⍵ }{ (∧\' '≠⍵)/⍵ }¨⊂[(1+⎕io)]⎕nl ⍙class
∇
∇z←⍙class ne ⍙set
⍝ Return a character array of every workspace name which excludes
⍝ any character in ⍙set. The empty set excludes nothing. The
⍝ optional ⍙class argument selects results by name class; the
⍝ default is 2 3 4 (variables, functions and operators).
⍎(0=⎕nc '⍙class')/'⍙class←2 3 4'
z←⊃{ (~∨/⊃(⊂,⍙set)∊¨⍵)/⍵ }{ (∧\' '≠⍵)/⍵ }¨⊂[(1+⎕io)]⎕nl ⍙class
∇
If you want to list all names not containing ⍙, do this:
ne '⍙'
To get just the variables:
2 ne '⍙'
Or just the functions:
3 ne '⍙'
Or just the operators:
4 ne '⍙'
The ni function is complementary.
Add a ]usercmd definition or three to customize this to your taste...
On Wed, 2014-07-09 at 23:12 +0800, Elias Mårtenson wrote:
How about having the )FNS, )OPS and )VARS commands filter out names
that contain a ⍙ symbol by default? Since the idea is that those are
internal names it would make sense to hide them (unless some other
flag is given).
Opinions?
Regards,
Elias
[Prev in Thread] | Current Thread | [Next in Thread] |