---------------------------------------------------------
D-functions and operators loosely grouped into categories
---------------------------------------------------------
Click function name in list below to see notes, and within the note:
┌───────────── click here to see function coding
┌────────────────│─────────── ···
│ rslt ← larg ##.foo rarg ⍝ description ···
│
│ ··· related function →goo← is a ···
│ │
│ See also: hoo koo ··· │
└───────────│───────────│─── ···
│ │
│ │
└───────────┴─── click here to see notes for related function.
Note that some functions appear in more than one category.
· Structures.
· ·
· · Arrays.
· · · alists ⍝ Association lists.
· · · acc ⍝ Accumulating reduction.
· · · box ⍝ Box the simple text array ⍵.
· · · cmat ⍝ ⍺-combination matrix of ⍳⍵.
· · · disp ⍝ Boxed sketch of nested array.
· · · display ⍝ Boxed display of array.
· · · enlist ⍝ List ⍺-leaves of nested array.
· · · enss ⍝ Emulate (∊⍺)←⍵.
· · · find ⍝ Lines containing string(s) ⍵.
· · · from ⍝ Select (1↓⍴⍵)-cells from array.
· · · foldl ⍝ Fold (reduce) from the left.
· · · iotag ⍝ Generalized iota.
· · · key ⍝ Key operator.
· · · lex ⍝ Lexicographical comparison of arrays ⍺ and ⍵.
· · · list ⍝ List from vector ⍵.
· · · ltrav ⍝ List traversal.
· · · merge ⍝ Suggestion for a merge operator.
· · · mesh ⍝ ⍺-enmesh items of vector ⍵.
· · · mns ⍝ Make NS from association list ⍵.
· · · pack ⍝ Saves WS by sharing identical sub-arrays.
· · · perv ⍝ Scalar pervasion, apply function between scalars.
· · · pmat ⍝ Permutation matrix of ⍳⍵.
· · · pred ⍝ Partitioned reduction.
· · · rank ⍝ Apply function to/between sub-arrays.
· · · rows ⍝ Operand function applied to argument rows.
· · · sam ⍝ Select and modify.
· · · saw ⍝ Operand function applied Simple-Array-Wise.
· · · scan ⍝ Variations on primitive scan.
· · · subvec ⍝ Is ⍺ a subvector of ⍵?
· · · squad ⍝ IBM APL2 Indexing function.
· · · subs ⍝ Vector substitution.
· · · type ⍝ Array of type ⍺.
·
· · Trees
· · · BST ⍝ Binary Search Trees.
· · · · avl ⍝ Adelson-Velskii, Landis (AVL) trees.
· · · · sbst ⍝ Simple binary search trees.
· · · · redblack ⍝ Red-black trees.
· · · · splay ⍝ Splay trees.
· · · ddft ⍝ Display derived function tree.
· · · tfmt ⍝ Char matrix from tree(s).
· · · tnest ⍝ Array from TreeView style tree.
· · · tview ⍝ TreeView style tree from nested array.
· · · tree ⍝ Display of namespace tree.
·
· · Graphs
· · · assign ⍝ Hungarian method cost assignment.
· · · insnode ⍝ Insert vertex ⍵ in graph ⍺.
· · · remnode ⍝ Remove vertex ⍵ from graph ⍺.
· · · inslink ⍝ Insert edge ⍵ in graph ⍺.
· · · remlink ⍝ Remove edge ⍵ from graph ⍺.
· · · popnode ⍝ Pop vertex ⍵ to head of graph ⍺.
· · · search ⍝ Breadth-first search of graph ⍺.
· · · path ⍝ Shortest path from/to ⍵ in graph ⍺.
· · · span ⍝ Breadth-first spanning tree for graph ⍺.
· · · dfspan ⍝ Depth-first spanning tree for graph ⍺.
· · · stdists ⍝ Spanning tree path lengths.
· · · stpath ⍝ Path through spanning tree ⍺ to vertex ⍵.
· · · stpaths ⍝ Spanning tree paths.
·
· · wGraphs ⍝ Weighted graphs.
· · · wcost ⍝ Cost vector for path ⍵ through _weighted_ graph ⍺.
· · · wpath ⍝ Quickest path from/to ⍵ in _weighted_ graph ⍺.
· · · wspan ⍝ Spanning tree for _weighted_ graph ⍺ from ⍵.
· · · wmst ⍝ Minimum Spanning Tree for _weighted_ graph ⍺.
·
· · Words.
· · · ssword ⍝ Approx alternative to xutils' ss.
· · · words ⍝ Source vector split into words.
· · · tokens ⍝ Lex of APL source line.
· · · von ⍝ Capitalise first letters of names.
·
· · Strings.
· · · find ⍝ Search for string ⍵ in vars, fns and ops.
· · · just ⍝ Justify text array.
· · · lcase ⍝ Lower-casification.
· · · ucase ⍝ Upper-casification.
· · · mtrim ⍝ Trim trailing blank columns from matrix.
· · · ss ⍝ Approx alternative to xutils' string replacement.
· · · ssmat ⍝ Matrix search/replace.
· · · ssword ⍝ Approx alternative to xutils' word replacement.
· · · subs ⍝ Vector substitution.
· · · subvec ⍝ Is ⍺ a subvector of ⍵?
· · · squeeze ⍝ Compress multiple blanks.
· · · timestamp ⍝ Time-stamped message.
· · · xtabs ⍝ Expand/compress HT chars.
· · · htx ⍝ Extract html segments.
·
· · Line_vectors
· · · htx ⍝ Extract html segments.
· · · ltov ⍝ Lines to nested vector.
· · · vtol ⍝ Nested vector to lines.
· · · wrap ⍝ Wrap word vector at ⍺ columns.
· · · unwrap ⍝ Replace [LF] with blanks.
· · · justify ⍝ Justify line-vector to ⍺ columns.
· · · squeeze ⍝ Compress multiple blanks.
· · · vtrim ⍝ Trim trailing blanks from line-vector.
· · · wrapnote ⍝ Wrap text paragraphs in note vector.
· · · xtabs ⍝ Expand/compress HT chars.
·
· · Blank_removal
· · · dlb ⍝ Drop Leading Blanks.
· · · dtb ⍝ Drop Trailing Blanks.
· · · deb ⍝ Drop Ending Blanks.
· · · dxb ⍝ Drop eXtraneous Blanks.
· · · dmb ⍝ Drop Multiple Blanks.
· · · dab ⍝ Drop All Blanks.
·
· · Data_compression
· · · packB ⍝ Pack a simple array.
· · · packD ⍝ Pack char array to boolean vector.
· · · packH ⍝ Huffman packing.
· · · packN ⍝ Zero packing.
· · · packQ ⍝ Assorted uniQues packer.
· · · packR ⍝ RLE packing.
· · · packS ⍝ Shannon-Fano packing.
· · · packT ⍝ Simple text vector packager.
· · · packU ⍝ Unique packer.
· · · packX ⍝ TeXt packer.
· · · packZ ⍝ Lempel-Ziv-Welch.
·
· · Power.operators
· · · cond ⍝ Conditional function application.
· · · do ⍝ Apply no-result function "en passant".
· · · else ⍝ Condition f else g ...
· · · for ⍝ Multiple selection of function list.
· · · inverse ⍝ General function inverse.
· · · invr ⍝ Approx inverse of real-valued function.
· · · invs ⍝ Symbolic inverse.
· · · limit ⍝ Function power limit (fixpoint).
· · · pow ⍝ Explicit function power.
· · · traj ⍝ Function limit "trajectory".
· · · while ⍝ Conditional function power.
· · · until ⍝ Conditional function power.
·
· · Function_arrays
· · · case ⍝ select statement.
· · · for ⍝ Multiple selection of function list.
· · · of ⍝ pick'th fn applied to arg.
· · · lof ⍝ List of functions.
· · · logic ⍝ logical function array.
· · · vof ⍝ Vector of functions.
· · · fnarray ⍝ Array of functions.
·
· · Syntax.operators
· · · cond ⍝ Conditional function application.
· · · do ⍝ Apply no-result function "en passant".
· · · fork ⍝ Function fork.
· · · rank ⍝ Apply function to/between sub-arrays.
·
· · Expressions.
· · · ddft ⍝ Display derived function tree.
· · · htx ⍝ Extract html segments.
· · · rmcm ⍝ Remove comment from line of APL.
· · · Parsing ⍝ Parsing of D-expressions.
· · · · tokens ⍝ Lex of APL source line.
· · · · tclass ⍝ Classification of tokens.
· · · · parse ⍝ Bunda-Gerth parse of expr ⍵.
· · · · pfmt ⍝ Char matrix format of parse tree.
· · · unify ⍝ Unification of expressions.
·
· Numbers.
· ·
· · Whole.numbers
· · · big ⍝ Arithmetic on large integers.
· · · bsearch ⍝ Binary search: least n in range ⍵ such that ⍺⍺ n.
· · · bt ⍝ Balanced Ternary Arithmetic.
· · · cfract ⍝ Continued fraction approximation of real number.
· · · dec ⍝ Decimal from hexadecimal.
· · · decf ⍝ Numbers from (big-endian) floating hex.
· · · efract ⍝ Egyptian fraction for ⍺÷⍵.
· · · esh ⍝ Shell for Eide-number sums.
· · · factorial ⍝ Tail-recursive factorial.
· · · fibonacci ⍝ Tail-recursive Fibonacci.
· · · factors ⍝ Prime factors of ⍵.
· · · gcd ⍝ Greatest common divisor.
· · · lcm ⍝ Least common multiple.
· · · hex ⍝ Hexadecimal from decimal.
· · · hexf ⍝ (big-endian) hex display of float array.
· · · int ⍝ Signed from unsigned integers.
· · · nats ⍝ Natural number arithmetic.
· · · osc ⍝ Oscillate - probably returns 1.
· · · range ⍝ Numeric range classification.
· · · rational ⍝ Rational number close to real ⍵.
· · · rats ⍝ Rational arithmetic.
· · · ratsum ⍝ ⍺⍺-rational sum of ⍺ and ⍵.
· · · stamps ⍝ Postage stamps to the value of ⍵.
· · · sieve ⍝ Sieve of Eratosthenes.
· · · to ⍝ Sequence ⍺ .. ⍵
· · · uns ⍝ Unsigned from signed integers.
·
· · Real.numbers
· · · abc ⍝ Arithmetic Boundary Checking.
· · · cfract ⍝ Continued fraction approximation of real number.
· · · det ⍝ Determinant of square numeric matrix.
· · · efract ⍝ Egyptian fraction for ⍺÷⍵.
· · · gauss_jordan ⍝ Gauss-Jordan elimination.
· · · invr ⍝ Approx inverse of real-valued function.
· · · kcell ⍝ Relationship between point and k-cell.
· · · kball ⍝ Relationship between point and k-ball.
· · · mean ⍝ Arithmetic mean.
· · · rational ⍝ Rational number near real ⍵.
· · · rats ⍝ Rational arithmetic.
· · · ratsum ⍝ ⍺⍺-rational sum of ⍺ and ⍵.
· · · root ⍝ ⍺'th root.
· · · roots ⍝ Real roots of quadratic.
·
· · Complex.numbers
· · · cx ⍝ Complex arithmetic.
· · · cxsh ⍝ Complex shell.
· · · polar ⍝ Polar from cartesian coordinates.
·
· · Dates
· · · days ⍝ Day number from ⎕TS format.
· · · date ⍝ ⎕TS format from day number.
· · · easter ⍝ Easter Day in year ⍵.
· · · timestamp ⍝ Time-stamped message.
·
· Workspace.administration
· ·
· · Workspaces
· · · dfnscode ⍝ Formatted dfns code.
· · · dfnsnotes ⍝ Formatted dfns notes.
· · · fndiff ⍝ Defined function differences.
· · · index ⍝ ⍵-index of notes in space ⍺.
· · · html ⍝ Export this WS to ⍵\*.htm.
· · · refws ⍝ Ref to "saved" ws ⍵.
· · · test ⍝ Run test script: no news => good news.
· · · utf8 ⍝ ⎕AV ←→ UTF-8 translation.
· · · wsdiff ⍝ Workspace differences.
· · · wsmerge ⍝ {protected} merge from saved ws.
· · · xhtml ⍝ Export this WS to ⍵\*.htm.
· · · xws ⍝ Execute expr ⍺ in saved ws ⍵.
·
· · Namespaces
· · · index ⍝ ⍵-index of notes in space ⍺.
· · · mns ⍝ Make NS from association list ⍵.
· · · nspack ⍝ Share arrays across space tree.
· · · refs ⍝ Vector of sub-space references.
· · · refmatch ⍝ Space reference match.
· · · tree ⍝ Display of namespace tree.
· · · up ⍝ Ref to ⍵-parent of space ⍺.
· · · vwise ⍝ Variable-wise: apply ⍺⍺ to each var in space ⍵.
· · · xrefs ⍝ Extract refs vector from array ⍵.
·
· · Functions.and.operators
· · · ambiv ⍝ Ambivalize traditional functions: ⍵.
· · · attrib ⍝ Function/operator attributes.
· · · defn ⍝ D-fine function.
· · · dots ⍝ Show dfn with "white dots".
· · · find ⍝ Search for string ⍵ in vars, fns and ops.
· · · fix ⍝ Fix function/operator rep.
· · · fndiff ⍝ Defined function differences.
· · · fnrefs ⍝ External refs from function ⍵.
· · · fnrepl ⍝ Function string replacement.
· · · isdfn ⍝ Test for D function.
· · · nc ⍝ Extended ⎕NC for ojects named in ⍵.
· · · ncpath ⍝ ⎕path-aware ⎕nc.
· · · refmt ⍝ Reformat dfn/op.
· · · rep ⍝ Representation of function/operator.
· · · trace ⍝ Trace function application.
· · · UndoRedo ⍝ Derive undo/redo function.
·
· Files.
· ·
· · Native.files
· · · file ⍝ Apply operand function to native file tie.
· · · getfile ⍝ Get text file ⍵ as nested vector.
· · · hexdump ⍝ Hex dump of native file.
· · · putfile ⍝ Put rows to text-file.
· · · utf8 ⍝ ⎕AV ←→ UTF-8 translation.
· · · utf8get ⍝ Char vector from UTF-8 file ⍵.
· · · utf8put ⍝ Char vector ⍺ to UTF-8 file ⍵.
· · · xtabs ⍝ Expand/compress HT chars.
·
· · Component.files
· · · filefind ⍝ Find 'string' ⍵ in component file ⍺.
·
· Diversions.
· ·
· · · baby ⍝ The Manchester Small Scale Experimental Machine.
· · · dice ⍝ Interpret a throw of dice.
· · · draw ⍝ Draw over '*'s.
· · · life ⍝ John Conway's "Game of Life".
· · · kt ⍝ Knight's Tour chess problem.
· · · mayan ⍝ Mayan numbers.
· · · maze ⍝ Kidz maze.
· · · mmind ⍝ Mastermind or "cows and bulls".
· · · mp3 ⍝ Create playlist(s) for mp3 directories.
· · · queens ⍝ N-queens chess problem.
· · · quzzle ⍝ A hard, simple problem.
· · · ripple ⍝ Perfect Ripple Shuffle.
· · · roman ⍝ Roman numeral arithmetic.
· · · sudoku ⍝ Solution vector for Sudoku problem ⍵.
·
· Performance.
· ·
· · · cf ⍝ Ratio of operand timings.
· · · cmpx ⍝ Approx expression timings.
· · · mdf ⍝ Monitor D function.
· · · memo ⍝ Function memoization.
· · · ticks ⍝ Sample Dfn execution clock ticks.
· · · time ⍝ Time function application.
· · · wsreq ⍝ WS required to execute expression ⍵.
------------------------
Person and Topic Indexes
------------------------
Function [index] generates ≤person≥ and ≤topic≥ indexes from those lines in each
note that start with the character vector 'Index'. In addition, the note for
→index← contains lines starting Index≡, which supply aliases of the form: "For
this, see that".
-------------------------
A note on code appearance
-------------------------
The functions and operators in the workspace have been formatted to make them
easier to read. For example, the "else" operator should look like this:
else←{ ⍝ Condition f else g ...
⍺:⍺⍺ ⍵ ⍝ True: apply left operand.
⍵⍵ ⍵ ⍝ False: apply right operand.
}
If you have [AutoFormat functions] checked in the Options→Configure→Trace/Edit
tab, the system will impose its own canonical formatting style. This is OK, but
makes the functions look a little odd:
else←{ ⍝ Condition f else g ...
⍺:⍺⍺ ⍵ ⍝ True: apply left operand.
⍵⍵ ⍵ ⍝ False: apply right operand.
}
To see the code in its intended format, uncheck the box and try again.
------------
Highlighting
------------
Words in the notes may be distinguished by various styles of bracket:
→link← Link to another note; double-click or Shift-Enter to follow the link.
[bold] Function or argument name, equivalent to bold font.
_ital_ Emphasised word, equivalent to italic font.
Dyalog Version considerations
-----------------------------
In order not to exclude people who are using an interpreter that is not as up-
to-date as the current version, this workspace is maintained using a slightly
older version. Places where this has an impact on the code, for example, where
improved methods have been avoided, are noted with a version marker: · <V>
This serves as a reminder of which parts of the workspace should be changed on
migration to a newer version of the interpreter.
-------
Colours
-------
When viewing these notes from an APL session (as opposed to a web browser), you
can change their colours, see: →colour_change←.
--------------
Test namespace
--------------
Namespace "scripts" contains test scripts for most of the functions and operat-
ors in the workspace. See →test←.
-----------------
Printing dfns.dws
-----------------
The notes and code from this workspace can be found in a printable PDF form in:
http://www.dyalog.com/dfnsdws/DfnsNotes.pdf
http://www.dyalog.com/dfnsdws/DfnsCode.pdf
--------
Feedback
--------
Suggestions for extending or improving this workspace would be most welcome via
email to: john@dyalog.com.
To join an email-based discussion group on D, email "dfns@dyalog.com" with sub-
ject: subscribe
Thanks for contributions from:
Adrian Smith
Blay Tarnoff
Dag Dittmer
Dan Baronet
David Crossley
Dick Bowman
Gianluigi Quario
Jim Ryan
John B. Halleck
John Niss Hansen
John R. Clark
Jonathan Barman
LeRoy N. Eide
Maria Wells
Mark Johns
Michael Kassler
Mike Day
Maurice Jordan
Michael Baas
Paul Mansour
Perttu Pakarinen
Peter-Michael Hager
Phil Last
Ray Cannon
Reima Naumanen
Stefano Lanzavecchia
Stephen Taylor
Steve Mansour
Veli-Matti Jantunen
Yves Bopp
Back to: Dyalog APL
Trouble seeing APL font?