Skip to content

Commit

Permalink
Fixes #10
Browse files Browse the repository at this point in the history
  • Loading branch information
xpqz committed Aug 13, 2021
1 parent 34e09c9 commit 46752ea
Show file tree
Hide file tree
Showing 9 changed files with 90 additions and 90 deletions.
Binary file modified contents/_build/.doctrees/at.doctree
Binary file not shown.
Binary file modified contents/_build/.doctrees/environment.pickle
Binary file not shown.
Binary file modified contents/_build/.jupyter_cache/global.db
Binary file not shown.
48 changes: 24 additions & 24 deletions contents/_build/html/_sources/at.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"> Once you understand how to write a program get someone else to write it.\n",
"\\--_Alan Perlis_\n",
"\n",
"Let's look at the powerful immutable array update operator, _At_ (`@`). By \"immutable\" in this context we mean non-destructive -- it creates a new array, rather than mutating in place. Immutability is a good thing.\n",
"Let's look at the powerful immutable array update operator, _At_ (`@`). By \"immutable\", in this context, we mean non-destructive -- it creates a new array, rather than mutating in place. Immutability is a good thing.\n",
"\n",
"The dyadic `@` operator has a lot of moving parts, and we won't cover all possible combinations here. \n",
"\n",
Expand All @@ -28,7 +28,7 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": 2,
"metadata": {
"tags": [
"hide-output"
Expand All @@ -42,7 +42,7 @@
"</span>"
]
},
"execution_count": 1,
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
},
Expand All @@ -53,7 +53,7 @@
"</span>"
]
},
"execution_count": 1,
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -68,7 +68,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"`@` can take both functions and arrays as either operand. In its simplest form, the left operand specifies values, and the right operand indexes:"
"`@` can take both functions and arrays as either operand. In its simplest form, the left operand specifies values, and the right operand indices:"
]
},
{
Expand Down Expand Up @@ -291,7 +291,7 @@
"outputs": [],
"source": [
"]dinput\n",
"_At_{ ⍝ Partial @ - left and right operands must be functions, and the right arg a vector\n",
"_At_{ ⍝ Partial @ - left and right operands must be functions, and the right arg a vector\n",
" mutator ← ⍺⍺ ⍝ Left operand -- function only\n",
" selector ← ⍵⍵ ⍝ Right operand -- function only\n",
" data ← ⍵ ⍝ Derived function right argument -- vector only. Note: copy\n",
Expand Down Expand Up @@ -340,7 +340,7 @@
"outputs": [],
"source": [
"]dinput\n",
"_At_{ ⍝ Partial @ - left and right operands must be functions, and the right arg a vector\n",
"_At_{ ⍝ Partial @ - left and right operands must be functions, and the right arg a vector\n",
" data ← ⍵\n",
" (mask/data) ← ⍺⍺ (mask←⍵⍵ ⍵)/⍵\n",
" data\n",
Expand Down Expand Up @@ -374,7 +374,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"We used leading and trailing underscores when naming our operator to indicate visually that it's a dyad, as suggested by the unofficial [style guide](https://abrudz.github.io/style/#cc).\n",
"We used leading and trailing underscores when naming our operator to indicate visually that it's a dyad, as suggested by Adám Brudzewsky's unofficial [style guide](https://abrudz.github.io/style/#cc).\n",
"\n",
"## Higher rank: choose and reach\n",
"\n",
Expand All @@ -386,15 +386,15 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"If we look at [Dyalog's specification of `@`](https://help.dyalog.com/latest/#Language/Primitive%20Operators/At.htm) we have\n",
"If we look at [Dyalog's specification](https://help.dyalog.com/latest/#Language/Primitive%20Operators/At.htm) of `@` we have\n",
"\n",
"```apl\n",
"R←{X}(f@g)Y\n",
"```\n",
" \n",
"If `g` is a simple vector, it chooses _major cells_ in Y. If g is nested, it specifies indices for _choose_ or _reach_ indexing. What does that mean, then? One way to think of it is that the g vector behaves just as if it had been inserted between square brackets.\n",
"If `g` is a simple vector, it chooses _major cells_ in `Y`. If `g` is nested, it specifies indices for _choose_ or _reach_ indexing. What does that mean, then? One way to think of it is that the `g` vector behaves just as if it had been inserted between square brackets.\n",
"\n",
"The first case is straight-forward: the major cells of an array is basically those given by the first axis of the shape. In the case of a 2-D matrix, its rows:"
"The first case is straightforward: the major cells of an array are those given by the first axis of the shape. In the case of a 2D matrix, its rows:"
]
},
{
Expand Down Expand Up @@ -458,12 +458,12 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"We can also access elements that are deeply nested using _reach indexing_ which we met briefly in the [indexing](./indexing.ipynb) section:"
"We can also access elements that are deeply nested using _reach indexing_, which we met briefly in the [indexing](./indexing.ipynb) section:"
]
},
{
"cell_type": "code",
"execution_count": 18,
"execution_count": 6,
"metadata": {},
"outputs": [
{
Expand All @@ -481,7 +481,7 @@
"</span>"
]
},
"execution_count": 18,
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
},
Expand All @@ -500,14 +500,14 @@
"</span>"
]
},
"execution_count": 18,
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"⊢G←2 3⍴('Adam' 1)('Bob' 2)('Carl' 3)('Danni' 4)('Eve' 5)('Frank' 6)\n",
"'***' ¯999@((0 0)0)((1 2)1)G"
"⎕ ← G ← 2 3⍴('Adam' 1)('Bob' 2)('Carl' 3)('Danni' 4)('Eve' 5)('Frank' 6)\n",
"'***' ¯999@((0 0)0)((1 2)1)G"
]
},
{
Expand All @@ -528,7 +528,7 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 9,
"metadata": {},
"outputs": [
{
Expand All @@ -538,13 +538,13 @@
"</span>"
]
},
"execution_count": 6,
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"' '@(=∘'-')'Hello-World-One-Two'"
"' '@(=∘'-') 'Hello-World-One-Two'"
]
},
{
Expand Down Expand Up @@ -665,9 +665,9 @@
}
],
"source": [
"A1 2 3 4\n",
"B11 22 33 44\n",
"C0 1 0 1\n",
"A1 2 3 4\n",
"B11 22 33 44\n",
"C0 1 0 1\n",
"(C/⍥,B)@{C}A"
]
},
Expand Down Expand Up @@ -712,7 +712,7 @@
"metadata": {},
"outputs": [],
"source": [
"(C/A)C/B"
"(C/A)C/B"
]
},
{
Expand Down
Loading

0 comments on commit 46752ea

Please sign in to comment.