Skip to content

Commit

Permalink
Some examples for the Atop case of ⍤
Browse files Browse the repository at this point in the history
  • Loading branch information
xpqz committed Aug 12, 2021
1 parent c8e63f8 commit d7be5e9
Showing 1 changed file with 81 additions and 2 deletions.
83 changes: 81 additions & 2 deletions contents/rank.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -964,7 +964,7 @@
"source": [
"## Atop\n",
"\n",
"As we mentioned above, from version 18 of Dyalog, `⍤` can also be _Atop_ if given a right operand function instead of array. We'll see more of different kinds of _Atop_ later, but for now it's a functional composition rule, stating that (for the dyadic case),\n",
"As we mentioned above, from version 18 of Dyalog, `⍤` can also be _Atop_ if given a right operand function instead of array. We'll see more of different kinds of _Atop_ later in the [tacit](./tacit.ipynb) chapter, but for now it's a functional composition rule, stating that (for the dyadic case),\n",
"```apl\n",
"X f⍤g Y → f X g Y\n",
"```\n",
Expand All @@ -977,7 +977,86 @@
"X f⍤g Y → f X g Y\n",
"```\n",
"\n",
"As the monadic _Atop_ is equivalent for `∘` and `⍤`, it's worth using `⍤` for both monadic and dyadic atops for consistency."
"Another way to think about it is that in the dyadic case, the difference between `∘` and `⍤` is which operand function (`f` or `g`) gets the left argument. In the monadic case, _Atop_ is equivalent for `∘` and `⍤`, so it's worth using `⍤` for both monadic and dyadic atops for consistency. \n",
"\n",
"Here is a simple example of a dyadic _Atop_,"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<span style=\"white-space:pre; font-family: monospace\">¯5 ¯7 ¯9\n",
"</span>"
]
},
"execution_count": 1,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"1 2 3 -⍤+ 4 5 6 ⍝ Negate the sum of two vectors"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"which, following the `X f⍤g Y → f X g Y` rule, is the same as"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<span style=\"white-space:pre; font-family: monospace\">¯5 ¯7 ¯9\n",
"</span>"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"-1 2 3+4 5 6 ⍝ Negate the sum of two vectors"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"or, as a tacit formulation (which we'll cover in more detail later),"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<span style=\"white-space:pre; font-family: monospace\">¯5 ¯7 ¯9\n",
"</span>"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"1 2 3 (-+) 4 5 6 ⍝ Negate the sum of two vectors"
]
},
{
Expand Down

0 comments on commit d7be5e9

Please sign in to comment.