Skip to content

Commit

Permalink
Add a document with the explanations
Browse files Browse the repository at this point in the history
  • Loading branch information
vendethiel committed Oct 22, 2015
1 parent b503a47 commit 26edcbf
Show file tree
Hide file tree
Showing 11 changed files with 119 additions and 25 deletions.
5 changes: 5 additions & 0 deletions assign.apl
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
simple assignment
N3

special value: ⎕ is stdout
'hello world'
10 changes: 2 additions & 8 deletions compose.apl
Original file line number Diff line number Diff line change
@@ -1,8 +1,2 @@
compose + and × (dot-free style)
2 1000(+.×)4 5

is basically:
+/2 1000×4 5

or
+/(2×4) (1000×5)
Doesn't work in GNU APL :(
() 3 4
78 changes: 78 additions & 0 deletions contents.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
=== Table of contents

<table>
<thead>
<tr>
<td>Filename</td>
<td>Symbol</td>
<td>Monadic</td>
<td>Dyadic</td>
<td>Operator <i>(higher-order)</i></td>
</tr>
</thead>
<tbody>
<tr>
<td>flat-contains (epsilon)</td>
<td>∊</td>
<td>Enlist</td>
<td>Membership</td>
<td></td>
</tr>
<tr>
<td>assign (left arrow)</td>
<td>←</td>
<td></td>
<td>←</td>
<td></td>
</tr>
<tr>
<td>shaped (rho)</td>
<td>⍴</td>
<td>Shape-of</td>
<td>Reshape</td>
<td></td>
</tr>
<tr>
<td>resize (up arrow)</td>
<td>↑</td>
<td>Roll</td>
<td>Deal</td>
<td></td>
</tr>
<tr>
<td>rand (question mark)</td>
<td>?</td>
<td>Roll</td>
<td>Deal</td>
<td></td>
</tr>
<tr>
<td>function (alpha and omega are the arguments)</td>
<td>{ <i>and</i> }</td>
<td>⍵ <b>(monadic argument)</b></td>
<td>⍺ <b>(dyadic argument)</b></td>
<td>function</td>
</tr>
<tr>
<td>compose [<b>Dyalog only???</b>] (jot - higher-order function)</td>
<td>∘</td>
<td></td>
<td></td>
<td>monadic compose (e.g.: ⍴∘⍴)</td>
</tr>
<tr>
<td>inner-product (dot)</td>
<td>.</td>
<td></td>
<td></td>
<td>inner product (e.g.: +.×)(becomes outer product when composed with jot)</td>
</tr>
<tr>
<td>outer-product (jot/dot - higher-order function)</td>
<td>∘. (monadic argument: operator)</td>
<td></td>
<td></td>
<td>outer product (e.g.: ∘.+)</td>
</tr>
</tbody>
</table>
11 changes: 11 additions & 0 deletions flat-contains.apl
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
monadic: enlist (flatten)
0 ((1 2) (3 4) (5 6))

dyadic: contains
[a] is contained in [b]
11 2 3
1 2 41 2 3

'Matrix'
deep contain
(3 39)5
2 changes: 0 additions & 2 deletions hello.apl

This file was deleted.

8 changes: 8 additions & 0 deletions inner-product.apl
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
compose + and × (dot-free style)
2 1000(+.×)4 5

is basically:
+/2 1000×4 5

or
+/(2×4) (1000×5)
File renamed without changes.
14 changes: 0 additions & 14 deletions prob.apl

This file was deleted.

6 changes: 5 additions & 1 deletion rand.apl
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
rand(1..3), rand(1..4), rand(1..5)
monadic: roll
?3 4 5

just generate dices 25x 1d20
?2520

how many critical hits? sum of the dies that rolled 20
?2520

dyadic: deal
picks ⍺x 1d⍵
3?1000
5 changes: 5 additions & 0 deletions resize.apl
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
monadic: first
(6 4) 5 0 3

dyadic: take (zero-pads if ⍺>⍴⍵)
3010
5 changes: 5 additions & 0 deletions shaped.apl
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
reshape
5 6 30 outer size=5, inner size=6
range (iota)=30

shape of
5 6 30 easy enough, (5 6)

0 comments on commit 26edcbf

Please sign in to comment.