bug-apl
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug-apl] Workspace name listing utility


From: David Lamkins
Subject: [Bug-apl] Workspace name listing utility
Date: Fri, 11 Jul 2014 11:30:14 -0700

Here's a more developed version of the utility functions I posted a few days ago. I've added a ]usercmd wrapper.

⍝!

∇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


∇⍙args nlf_ucmd ⍙line
  →(3>⍴⍙args)/help
  →(4>⍴⍙args)/disp
  →(~∨/4='234'⍳3↓⍙args)/disp
  'class must be in 2 3 4'
  →help
disp:
  →('ie'∊↑1↓⍙args)/inc,exc
help:
  ((∧\' '≠⍙line)/⍙line),' i|e set [class]'
  →('?'≠↑1↓⍙args)/0
  'Display workspace names'
  '  i: show names having all characters in set'
  '  e: show names having any character not in set'
  '  set: any of a-z, A-Z, 0-9, ∆⍙_¯'
  '  class: selects name class(es)'
  '    2: variables; 3: functions; 4: operators'
  →0
inc:
  →(3<⍴⍙args)/iwc
  ni ↑2↓⍙args
  →0
iwc:
  (⍎¨3↓⍙args) ni ↑2↓⍙args
  →0
exc:
  →(3<⍴⍙args)/ewc
  ne ↑2↓⍙args
  →0
ewc:
  (⍎¨3↓⍙args) ne ↑2↓⍙args


]usercmd ]nlf nlf_ucmd 1


--
"The secret to creativity is knowing how to hide your sources."
   Albert Einstein


http://soundcloud.com/davidlamkins
http://reverbnation.com/lamkins
http://reverbnation.com/lcw
http://lamkins-guitar.com/
http://lamkins.net/
http://successful-lisp.com/

reply via email to

[Prev in Thread] Current Thread [Next in Thread]