diff --git a/contents/_build/.doctrees/at.doctree b/contents/_build/.doctrees/at.doctree index d7e71da..bb45f7d 100644 Binary files a/contents/_build/.doctrees/at.doctree and b/contents/_build/.doctrees/at.doctree differ diff --git a/contents/_build/.doctrees/environment.pickle b/contents/_build/.doctrees/environment.pickle index 9c9d5e2..e3ae615 100644 Binary files a/contents/_build/.doctrees/environment.pickle and b/contents/_build/.doctrees/environment.pickle differ diff --git a/contents/_build/.jupyter_cache/global.db b/contents/_build/.jupyter_cache/global.db index f0e7246..9570b80 100644 Binary files a/contents/_build/.jupyter_cache/global.db and b/contents/_build/.jupyter_cache/global.db differ diff --git a/contents/_build/html/_sources/at.ipynb b/contents/_build/html/_sources/at.ipynb index e8c24e9..71548cc 100644 --- a/contents/_build/html/_sources/at.ipynb +++ b/contents/_build/html/_sources/at.ipynb @@ -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", @@ -28,7 +28,7 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": 2, "metadata": { "tags": [ "hide-output" @@ -42,7 +42,7 @@ "" ] }, - "execution_count": 1, + "execution_count": 2, "metadata": {}, "output_type": "execute_result" }, @@ -53,7 +53,7 @@ "" ] }, - "execution_count": 1, + "execution_count": 2, "metadata": {}, "output_type": "execute_result" } @@ -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:" ] }, { @@ -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", @@ -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", @@ -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", @@ -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:" ] }, { @@ -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": [ { @@ -481,7 +481,7 @@ "" ] }, - "execution_count": 18, + "execution_count": 6, "metadata": {}, "output_type": "execute_result" }, @@ -500,14 +500,14 @@ "" ] }, - "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" ] }, { @@ -528,7 +528,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 9, "metadata": {}, "outputs": [ { @@ -538,13 +538,13 @@ "" ] }, - "execution_count": 6, + "execution_count": 9, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "' '@(=∘'-')⊢'Hello-World-One-Two'" + "' '@(=∘'-') 'Hello-World-One-Two'" ] }, { @@ -665,9 +665,9 @@ } ], "source": [ - "A←1 2 3 4\n", - "B←11 22 33 44\n", - "C←0 1 0 1\n", + "A ← 1 2 3 4\n", + "B ← 11 22 33 44\n", + "C ← 0 1 0 1\n", "(C/⍥,B)@{C}A" ] }, @@ -712,7 +712,7 @@ "metadata": {}, "outputs": [], "source": [ - "(C/A)←C/B" + "(C/A) ← C/B" ] }, { diff --git a/contents/_build/html/at.html b/contents/_build/html/at.html index b8d0b5d..1faa943 100644 --- a/contents/_build/html/at.html +++ b/contents/_build/html/at.html @@ -377,7 +377,7 @@

The At operator: @). By “immutable” in this context we mean non-destructive – it creates a new array, rather than mutating in place. Immutability is a good thing.

+

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.

The dyadic @ operator has a lot of moving parts, and we won’t cover all possible combinations here.

References for @: