Size: 3560
Comment:
|
← Revision 9 as of 2012-07-16 14:01:26 ⇥
Size: 972
Comment:
|
Deletions are marked like this. | Additions are marked like this. |
Line 1: | Line 1: |
= User Command ListObjects = | #If you want to "own" this page you MUST ask one of the admins to do this for you |
Line 3: | Line 3: |
<<TableOfContenst>> | = User Command {whatever} = |
Line 7: | Line 7: |
`ListObjects` is a utility useful to list all sorts of objects in a given namespace. Tired of looking up all the different 2.1, 3.2 and 9.4 in the help? Want to know what's an instance of an ordinary class and what's an instance of a form? Then you will love `ListObjects`! | {whatever} is a utility useful to .... |
Line 9: | Line 9: |
Let's assume that you are in a clear workspace. Let's create a couple of objects in this workspace: | Obviously it makes sense to make {whatever} available as a User Command. This page offers a small class script `{whatever}` which is designed to do exactly that. == Assumptions == When User Commands got introduced in Dyalog with version 12.1, the User Commands where expected to reside in a sub folder `Salt\Spice` inside the Dyalog installation folder. This means that the script `{whatever}` attached to this page must go into this directory. Only then the User Commd "{whatever}" is recognized. == Samples == |
Line 12: | Line 20: |
⎕FX 'r←Hello' 'r←''World''' sum←{+/⍵} ⎕FX 'r←(fns MyOp) array' 'r←fns array' myNamespace←⎕ns '' myNamespace.⎕FX 'r←Hello' 'r←''World''' 'myNamespace2' ⎕ns '' ⎕FIX ':Class MyClass' '∇ Make' ':Access Public Instance' ':Implements Constructor' '∇' ':EndClass' myInstance1←⎕new ⊂MyClass 'myInstance2' ⎕WC 'Form' ('KeepOnClose' 1) |
{whatever} in action .... |
Line 23: | Line 23: |
== Examples == Calling `ListObjects` without an argument and switch: {{{ ]ListObjects ⎕NC Name Type === ==== ==== 3.1 Hello Traditional function 9.4 MyClass Class 4.1 MyOp Traditional Operator 9.2 myInstance1 Instance 9.2 myInstance2 Form (Instance) 9.1 myNamespace Namespace 9.1 myNamespace2 Namespace 3.2 sum Direct function 3.1 test Traditional function }}} == Argument == ` By default `ListObjects` looks "into" the namespace it was called from; in our example this is `#`. If you want to list the contents of a different namespace or instance you can specify the name of that object as an argument: {{{ ]ListObjects #.myNamespace_defau ⎕NC Name Type === ==== ==== 3.1 Hello Traditional function }}} In our case this is empty, of course. Note that if you don't qualify the name fully then `ListObjects` adds the name of the object it was called from. So this (note the missing "'''#.'''"): {{{ ]ListObjects #.myNamespace ⎕NC Name Type === ==== ==== 3.1 Hello Traditional function }}} works as well. == Switches == There are two optional switches available: === Name class switch === By default all objects are listed. You can specify the nameclass(es) you are interested in by specifying the `-nc` switch: {{{ ]ListObjects -nc=9.1 ⎕NC Name Type === ==== ==== 9.1 myNamespace Namespace 9.1 myNamespace2 Namespace ]ListObjects -nc=3 4 ⎕NC Name Type === ==== ==== 3.1 Hello Traditional function 4.1 MyOp Traditional Operator 3.2 sum Direct function 3.1 test Traditional function }}} === "Start with" switch === With the `=s` switch you can specify one or more characters {{{ ]listob -s=Mm ⎕NC Name Type === ==== ==== 9.4 MyClass Class 4.1 MyOp Traditional Operator 9.2 myInstance1 Instance 9.2 myInstance2 Form (Instance) 9.1 myNamespace Namespace 9.1 myNamespace2 Namespace }}} Note that this switch works in the same way as the (optional) left argument to `⎕NL`. |
|
Line 109: | Line 25: |
The script is version 1.0 from 2012-07-15 Author: KaiJaeger |
The script is version 1.0 from 2009-mm-dd Author: {you} |
Line 113: | Line 30: |
CategoryDyalogUserCommands | ''Remove the "C" in front of one of the following lines and delete the other one:'' CCategoryAplWinUserCommands CCategoryDyalogUserCommands |
User Command {whatever}
Overview
{whatever} is a utility useful to ....
Obviously it makes sense to make {whatever} available as a User Command.
This page offers a small class script {whatever} which is designed to do exactly that.
Assumptions
When User Commands got introduced in Dyalog with version 12.1, the User Commands where expected to reside in a sub folder Salt\Spice inside the Dyalog installation folder. This means that the script {whatever} attached to this page must go into this directory. Only then the User Commd "{whatever}" is recognized.
Samples
{whatever} in action ....
Version
The script is version 1.0 from 2009-mm-dd
Author: {you}
Remove the "C" in front of one of the following lines and delete the other one:
CCategoryAplWinUserCommands
CCategoryDyalogUserCommands