Under: Difference between revisions
(Created page with "{{Built-in|Under|⍢}} is a primitive dyadic operator which takes two function operands. It pre-processes it's argument(s) with the monadic...") |
(SHARP and J history) |
||
Line 1: | Line 1: | ||
{{Built-in|Under|⍢}} is a [[primitive operator|primitive]] [[dyadic operator]] which takes two [[function]] [[operand]]s. It pre-processes | {{Built-in|Under|⍢}}, or '''Dual''' (<code>¨</code>), is a [[primitive operator|primitive]] [[dyadic operator]] which takes two [[function]] [[operand]]s. It pre-processes its argument(s) with the monadic right operand, before applying the left operand on/between the result(s), then undoing the pre-processing.<ref>[https://mlochbaum.github.io/BQN/help/under.html BQN: Circle Jot (⌾)]</ref> | ||
== Model == | == Model == | ||
Line 10: | Line 10: | ||
7 0 8 | 7 0 8 | ||
== | == History == | ||
===References | The Dual operator, written <code>¨</code>, appeared in 1983 both in [[Rationalized APL]] and [[SHARP APL]]<ref>[https://www.jsoftware.com/papers/satn45.htm "Language Extensions of May 1983"]. SATN-45, 1983-05-02.</ref> just after. In both cases it was defined to be a [[close composition]], so that the overall function has the rank of the right operand; this allows <code>¨></code> to serve the purpose of [[Each]] from a [[Nested array model|nested]] APL. Iverson changed the name to Under for his 1987 [[A Dictionary of APL]], and [[J]] uses this name as well. It includes both a close form <source lang=j inline>&.</source> like SHARP and a non-close form <source lang=j inline>&.:</source>. | ||
== External links == | |||
* [[J]]: <source lang=j inline>&.</source> [https://code.jsoftware.com/wiki/Vocabulary/ampdot NuVoc], [https://www.jsoftware.com/help/dictionary/d631.htm dictionary]; <source lang=j inline>&.:</source> [https://code.jsoftware.com/wiki/Vocabulary/ampdotco NuVoc], [https://www.jsoftware.com/help/dictionary/d631c.htm dictionary] | |||
== References == | |||
<references/> | <references/> | ||
{{APL built-ins}}[[Category:Primitive operators]][[Category:Composition operators]] | {{APL built-ins}}[[Category:Primitive operators]][[Category:Composition operators]] |
Revision as of 15:52, 25 April 2022
⍢
|
Under (⍢
), or Dual (¨
), is a primitive dyadic operator which takes two function operands. It pre-processes its argument(s) with the monadic right operand, before applying the left operand on/between the result(s), then undoing the pre-processing.[1]
Model
In dialects that support user-defined operators and invertible functions, it can be defined as (or similar):
_U_ ← {⍺←{⍵ ⋄ ⍺⍺} ⋄ ⍵⍵⍣¯1⊢(⍵⍵ ⍺)⍺⍺(⍵⍵ ⍵)}
Examples
⍝ https://leetcode.com/problems/add-two-numbers/ 2 4 3 +_U_(10⊥⌽) 5 6 4 7 0 8
History
The Dual operator, written ¨
, appeared in 1983 both in Rationalized APL and SHARP APL[2] just after. In both cases it was defined to be a close composition, so that the overall function has the rank of the right operand; this allows ¨>
to serve the purpose of Each from a nested APL. Iverson changed the name to Under for his 1987 A Dictionary of APL, and J uses this name as well. It includes both a close form &.
like SHARP and a non-close form &.:
.
External links
- J:
&.
NuVoc, dictionary;&.:
NuVoc, dictionary
References
- ↑ BQN: Circle Jot (⌾)
- ↑ "Language Extensions of May 1983". SATN-45, 1983-05-02.