# Teaching and Learning APL¶

## New in v18.0¶

• Primitives: atop ⍤ | constant ⍨ | over ⍥ | unique mask ≠

• Initial cross-platform support for .NET Core

• ⎕C Case folding/mapping system function

• Multi-line session input

• HTMLRenderer

## New operator: Atop ⍤¶

(f g) x

⍺ (f g) ⍵ ←→ f ⍺ g ⍵

In [3]:
vowels←'AEIOUaeiou'

'Hello APL Germany'(⍸∊)vowels ⍝ Where are the vowels?

'Hello APL Germany'⍸⍤∊vowels

Out[3]:
2 5 7 12 15
Out[3]:
2 5 7 12 15
In [4]:
'Hello APL Germany'(∨/∊)vowels ⍝ Are there any vowels?

'Hello APL Germany'∨/⍤∊vowels

Out[4]:
1
Out[4]:
1
In [5]:
'Hello APL Germany'(∧/∊)vowels ⍝ Are they all vowels?

'Hello APL Germany'∧/⍤∊vowels

Out[5]:
0
Out[5]:
0

## New function: Unique mask ≠¶

Does what it says

In [15]:
{1@(⍵⍳∪⍵)⊢⍬⍴⍨≢⍵}'Hello, World!'

Out[15]:
1 1 1 0 1 1 1 1 0 1 0 1 1
In [12]:
≠'Hello, World!'

Out[12]:
1 1 1 0 1 1 1 1 0 1 0 1 1
In [13]:
(⍉≠,⍪)'Hello, World!'

Out[13]:
1 1 1 0 1 1 1 1 0 1 0 1 1 H e l l o , W o r l d !
In [14]:
(≠⊢⍤/⊢)'Hello, World!'

Out[14]:
Helo, Wrd!

## New operator: Over ⍥¶

Apply a pre-processor to arguments and then process the results

In [2]:
⍝ dop definition
OVER←{(⍵⍵ ⍺)⍺⍺ ⍵⍵ ⍵}

In [3]:
∇ r ← larg(PostProc OVER PreProc)rarg
r ← (PreProc larg) PostProc (PreProc rarg)
∇

In [4]:
'HELLO'≡⍥⎕C'hello'

Out[4]:
1
In [5]:
'GROẞ MISTÄK'≡⍥⎕C'groß mistäk'

Out[5]:
1

## New operator: Constant ⍨¶

Derived function returns its operand

## Dyalog.tv¶

Dyalog '19: Tacit Techniques with Dyalog version 18.0 Operators | Marshall Lochbaum

Dyalog 17.1 defines ⍨ with a function operand ("Commute")

Dyalog 18.0 will allow an array operand: A⍨ is the function which returns A.

In [6]:
f ← 1 2 3⍨
f 3 4⍴⍬
f¨3 4⍴⍬

Out[6]:
1 2 3
Out[6]:
┌─────┬─────┬─────┬─────┐ │1 2 3│1 2 3│1 2 3│1 2 3│ ├─────┼─────┼─────┼─────┤ │1 2 3│1 2 3│1 2 3│1 2 3│ ├─────┼─────┼─────┼─────┤ │1 2 3│1 2 3│1 2 3│1 2 3│ └─────┴─────┴─────┴─────┘

The derived function A⍨ behaves identically to A{⍺⍺}, or the train (A⊣⊢). But it's different from {A}, which looks up the name A when run.

A constant function derived with Constant can be used to make constant arrays matching another array's shape, or part of it.

Array Shape
e⍨¨⍵ ⍴⍵
e⍨⍤¯2⊢⍵ 2↑⍴⍵
e⍨⍤3⊢⍵ ¯3↓⍴⍵
e⍨⌿⍵ 1↓⍴⍵
⍺∘.(e⍨)⍵ ⍺,⍥⍴⍵

These forms will be optimised in 18.0 so that generating large arrays with Constant is as fast as using reshape.

It can be used in place of {(⍴⍵)⍴⊂⍺}

In [6]:
1 2 3{(⍴⍵)⍴⊂⍺}'hello'
1 2 3{⍺⍨¨⍵}'hello'

Out[6]:
┌─────┬─────┬─────┬─────┬─────┐ │1 2 3│1 2 3│1 2 3│1 2 3│1 2 3│ └─────┴─────┴─────┴─────┴─────┘
Out[6]:
┌─────┬─────┬─────┬─────┬─────┐ │1 2 3│1 2 3│1 2 3│1 2 3│1 2 3│ └─────┴─────┴─────┴─────┴─────┘

## New in v18.0¶

• Primitives: atop ⍤ | constant ⍨ | over ⍥ | unique mask ≠

• ⎕C Case folding/mapping system function

## New in v18.0¶

• Initial cross-platform support for .NET Core

### Dyalog.tv¶

Dyalog '19: Cor(e) blimey, what's he up to now? | John Daintree

## New in v18.0¶

• Multi-line session input

## Old (17.1) but good¶

• HTMLRenderer (now on Linux)

## Teaching and Learning APL¶

• Jupyter notebooks / Binder

• APLcart.info

• APLwiki redux

## Teaching and Learning: Jupyter¶

In [7]:
⍝ You can execute APL code in cells like these
3⍴'WO'

Out[7]:
WOW

$\LaTeX$

Look how we can put LaTeX formatted maths right beside equivalent APL:

$e^{i \pi} = -1$

¯1=*○0J1 ⍝ APL in Markdown

In [2]:
*○0J1 ⍝ Executable APL
⎕←'this'

Out[2]:
¯1
Out[2]:
this

## Use cases¶

• How-to style documentation
• Set assignments to students

## Presenting a notebook¶

Using reveal.js, Jupyter Notebooks can be turned into slideshow presentations with little effort.

$pip install --user jupyter_contrib_nbextensions$ jupyter nbconvert SIGAPL2019.ipynb --to slides --ServePostProcessor.port=8888 --ServePostProcessor.ip='*' --post serve --SlidesExporter.reveal_theme=serif --ServePostProcessor.browser=none


### TryAPL¶

TryAPL can execute Dyalog Jupyter notebooks line by line (currently not LaTeX, HTML or SharpPlot). Simply go to the "Learn" tab and paste the notebook's URL in the bar at the bottom.

## How to get started¶

... but the steps are basically the following:

Jupyter Lab

Jupyter Hub

### The easiest way¶

Can't I quickly type up a notebook for my class or publication?

We've created a Dyalog Jupyter Binder. Simply click the Launch Binder link from https://github.com/Dyalog19/D16 and Binder will spawn a docker container just for you!

Materials from the Dyalog'19 presentation:

https://github.com/Dyalog19/D16

Want to share? Send notebooks to notebooks@dyalog.com

## APLcart ⊆⌈¶

How do I ⍰ in APL?

# APLcart.info

## APL Wiki redux¶

redux /ˈriːdʌks/

brought back; revived.

## APLWiki¶

For now:   aplwiki.miraheze.org

Soon:    aplwiki.com