Conversation started May 16, 2018 at 17:30.
May 16, 2018 17:30
Welcome to APL Cultivation.
We've been going through the user commands that ship with Dyalog APL.
If there are no other subject ideas, I'll continue with those. There should be plenty of time to show the most interesting ones that we didn't cover last week.
Also note that you can easily add your own user commands to ease common tasks that you do. Tomorrow's webinar will explain how to do so.
The last user commands we covered were ]Load and ]Save which allows you to store items in text files.
There is also a powerful user command that can take an entire populated workspace and save everything in text files. Each unscripted namespace becomes a directory, and each item within a namespace becomes a separate file.
If you do ]Snap /tmp/myproject -makedir -loadfn, the system will export everything necessary to that location (creating the directory if it doesn't exist) and also places a file called load_ws.dyalog there.
You can then regenerate you workspace as it was with ]Load /tmp/myproject/load_ws and then executing load_ws.
If you comment your code using markdown, you can use ]ADoc to automatically generate some documentation of it. ]ADoc MyClass will open your browser with a nicely formatted html document that has comments and syntax information gleaned from your code.
For a quick calendar, do:
]Calendar
@Adám
      May 2018
Su Mo Tu We Th Fr Sa
       1  2  3  4  5
 6  7  8  9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31
And you can specify a year or a month and a year, e.g.
]Calendar June 85
@Adám
     June 1985
Su Mo Tu We Th Fr Sa
                   1
 2  3  4  5  6  7  8
 9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30
If you are on Windows, you'll have a handful more user commands than if not.
Maybe the coolest of them is the Chart Wizard. It has a button in the IDE:
But it is also available as a user command. Try e.g. ]chart (⍳50)×↓|1○(500÷⍨⍳50)∘.×⍳50
If you're not on Windows, you can still generate charts using SharpPlot (for which ]Chart is just a GUI). Here's some example code for that.
If you ever run into trouble with your APL system, you may want to know the version numbers of various parts and dependencies of your APL system:
]Version -extended
May 16, 2018 17:52
@Adám
 Dyalog  16.0.31812 64-bit Unicode, BuildID 5b887e36
 OS      Linux 4.15.13-300.fc27.x86_64 #1 SMP Mon Mar 26 19:06:57 UTC 2018 x86_64
 SALT    2.701
 UCMD    2.2
 .NET    (unavailable)
 WS      16.0
 Conga   (unavailable)
 SQAPL   loaded from: cxdya63u64v.so
         Version=SQAPL/PE version 6.3.28200  built Aug 23 2016 13:34:32
         IniFile=SQAPL.INI
And if you're having trouble with a user command, you can get the version number of it with:
]uversion calendar
@Adám
1.12
And in version 17.0 that'll get you even more information.
If you change a SALTed object (i.e. it has been ]saveed to or ]loaded from a text file), and you then edit it, the changes will be saved back to the file.
Is there an equivilent of ⎕cr for user commands?
However, if you add or remove members from outside the editor, e.g. MyNamespace.Var←42, then this isn't saved to file.
@H.PWiz Kind of. ]uload cmdname will establish an object in the current location that contains the code of the cmdname user command. More about that in the webinar.
As you play around work in APL, you may crop up more such dependencies between the scripts and the actual members. You can check the integrity of your workspace using ]Check, and if you want to update a namespace script to match the current state, you can use ]ScriptUpdate MyNamespace.
Last week, I briefly mentioned ]file.compare.
There is actually a whole family user commands, all called Compare. They are in the groups SALT, WS, ARRAY, FN, and FILE. You can use them to compare two similar items, just may have done file diffs, but here you can do them on various things related to APL. E.g. ]WS.Compare path1/ws1 path2/ws2 compares two workspaces, and ]NS.Compare #.ns1 #.ns2 compares two namespaces.
Of course, if your items are stored in script files, you could use your favourite diff tool, but it probably doesn't have any understanding of the APL code involved.
If you want a "hardcopy" of your workspace or part of it, you can use ]document to list all items, describe what they are, and show how they look if typed into the session.
If you work with a lot of objects, especially if they point to each other, you may find ]findrefs useful. It will follow all pointers (refs) and report everything. E.g.
]findrefs ⎕SE
May 16, 2018 18:15
@Adám
 ⎕SE: followed 27 pointers to reach a total of 24 "refs"

  Name
  #.[Namespace].⎕SE (DF=⎕SE)
  #.[Namespace].⎕SE.Dyalog (DF=⎕SE.Dyalog)
  #.[Namespace].⎕SE.Dyalog.Callbacks (DF=⎕SE.Dyalog.Callbacks)
  #.[Namespace].⎕SE.Dyalog.Out (DF=⎕SE.Dyalog.Out)
  #.[Namespace].⎕SE.Dyalog.Out.B (DF=⎕SE.Dyalog.Out.B)
  #.[Namespace].⎕SE.Dyalog.Out.F (DF=⎕SE.Dyalog.Out.F)
  #.[Namespace].⎕SE.Dyalog.Out.L (DF=⎕SE.Dyalog.Out.L)
  #.[Namespace].⎕SE.Dyalog.Out.R (DF=⎕SE.Dyalog.Out.R)
  #.[Namespace].⎕SE.Dyalog.SALT (DF=⎕SE.Dyalog.SALT)
You may have used )fns and )obs to list functions and objects in the workspace.
However, they are quite limited in functionality. Instead, you can use the ]fnslike and ]obslike user commands which allow you to use globbing or regex to filter the results: Try it online!
There's also the ]locate user command which allows you to search for text anywhere in the workspace (Try it online!) including, among many other features, the ability to search APL-syntactically. As always for user commands; explore the possibilities with ]?locate.
A really cool user command is ]Map which draws a tree view of your workspace or (if given an argument) a specific namespace:
]Map ⎕SE.Dyalog
May 16, 2018 18:30
@Adám
⎕SE.Dyalog
·   Callbacks
·   ·   ∇ WSLoaded
·   Out
·   ·   ∇ Filter Rows SD flipBox pfnops
·   ·   ∘ Box Dft
·   ·   B
·   ·   ·   ~ fns state style trains
·   ·   F
·   ·   ·   ~ includequadoutput state
·   ·   L
·   ·   ·   ~ PFKey state
·   ·   R
·   ·   ·   ~ dots fns fold state style
·   SALT
·   ·   ~ List
·   SEEd → ⎕SE.[SessionEditor]
·   Utils
·   ·   ~ lc uc
·   ·   ∇ Version condRavel cut disp display dmb drvSrc dtb formatPar formatText fromXML fromto layoutPar layoutText lcase psmum repObj reshapeText setupKeys showCol showRow toMatrix toVector toXML trimEnds txtreplace u
The tree structure itself are the nested namespaces, while the lists of names are ordered by type; ~ are variables, are functions, are operators. It also displays ref-names and where they point.
I'll round off with maybe the most powerful user command of them all; ]Peek. It allows you to "peek" into a different workspace, execute an expression there, then come back with the result, all without polluting or modifying neither the current workspace, nor the workspace that was peeked into:
]peek dfns queens 5
@Adám
┌─────────┬─────────┐
│⍟ · · · ·│· ⍟ · · ·│
│· · ⍟ · ·│· · · · ⍟│
│· · · · ⍟│· · ⍟ · ·│
│· ⍟ · · ·│⍟ · · · ·│
│· · · ⍟ ·│· · · ⍟ ·│
└─────────┴─────────┘
How to place five queens on a 5-by-5 chess board without them being able to capture each other, all without even loading any utilities! How about that? :-)
And that's it for the user commands I found appropriate to present here in chat.
@all Any questions?
Btw, I'm always working on improving the user commands that ship with Dyalog, and implement new useful ones. If you have any ideas or requests, let me know.
E.g. in version 17.0 (due in only a couple of months!) you will be able to get help about almost anything in APL by entering ]Help subject, e.g. ]Help ⍤ or ]Help index error or ]help coolbar.
May 16, 2018 18:43
searches for coolbar
@EriktheOutgolfer :-)
@Adám uh, is that what you wanted me (and everyone else) to do?
@EriktheOutgolfer Not necessarily. It is just a random Windows GUI object that Dyalog APL supports natively. I'm just giving examples of the various subjects ]Help will cover.
@Adám ah, because your reply seems to imply otherwise...
@EriktheOutgolfer Oh, I was just smiling at how my mention-in-passing of a random term you didn't see before set you off on a search for info about it. Did you find anything?
May 16, 2018 18:47
@Adám ActiveX >_>
well, tbf, I don't think anybody could resist testing the coolness of something with "cool" in it :P
@EriktheOutgolfer ]Help coolbar will open you browser at help.dyalog.com/17.0/Content/GUI/Objects/CoolBar.htm (except if you specify -url which will then only give you the url without opening the browser).
@Adám ah, I don't use the browser, I just use the Language Help
@EriktheOutgolfer Well, you can just type coolbar and press F1.
Despite it not being the most interactive lesson we've had, I hope you found it useful. Don't forget to join me live tomorrow!
Thank you for participating.
 
Conversation ended May 16, 2018 at 18:51.