[Bug-apl] Filter fns with ⍙ (delta-underbar) in the name by default?

2014-07-09 Thread Elias Mårtenson
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


Re: [Bug-apl] Filter fns with ⍙ (delta-underbar) in the name by default?

2014-07-09 Thread David B. Lamkins
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