Mod: Difference between revisions
Content added Content deleted
(Created page with "{{primitive|x!y}} The '''Mod''', '''Modulo''', '''Remainder''' or '''Residue''' (see [https://aplwiki.com/wiki/Residue APL])) function, denoted by <code>!</code>, is used for...") |
(add mod differences from K3) |
||
(8 intermediate revisions by 2 users not shown) | |||
Line 1:
{{primitive|x!y}}
The '''
Up until the K4 dialect, the modulo verb had the following characteristics:
* <code>x</code> is the dividend and <code>y</code> is the divisor.
* [[Atomicity|left atomic]] on account of the [[rotate]] overload.
From K5 onward, the modulo primitive is flipped and [[Atomicity|right atomic.]]<ref>[https://chat.stackexchange.com/transcript/message/58587397#58587397 JohnEarnest on the order of arguments for mod in K]</ref>▼
<pre>
Line 16 ⟶ 23:
</pre>
==
[[Category:Verbs]]
▲[https://chat.stackexchange.com/transcript/message/58587397#58587397 JohnEarnest on the order of arguments for mod in K]
[[Category:Operator verbs]]
[[Category:Primitives]]
|
Latest revision as of 17:13, 13 July 2022
Mod
x!y
The mod, modulo, remainder or residue[1] function, denoted by !
, is used for modulo in K.
Up until the K4 dialect, the modulo verb had the following characteristics:
x
is the dividend andy
is the divisor.- left atomic on account of the rotate overload.
From K5 onward, the modulo primitive is flipped and right atomic.[2]
3!12 0 3!11 2 5!15 0 3!1 2 3 4 5 6 7 8 9 10 11 12 1 2 0 1 2 0 1 2 0 1 2 0