Mod: Difference between revisions
add mod differences from K3
mNo edit summary |
(add mod differences from K3) |
||
(6 intermediate revisions by one other user not shown) | |||
Line 1:
{{primitive|x!y}}
The '''Mod''', '''Modulo''', '''Remainder''' or '''Residue'''<ref>https://aplwiki.com/wiki/Residue</ref> function, denoted by <code>!</code>, is used for modulo in K.▼
▲The '''
Up until the K4 dialect, the modulo operator was [[Atomicity|left atomic]] on account of the [[rotate]] overload. ▼
Up until the K4 dialect, the modulo verb had the following characteristics:
From K5 onward, the modulo primitive is [[Atomicity|right atomic.]]<ref>[https://chat.stackexchange.com/transcript/message/58587397#58587397 JohnEarnest on the order of arguments for mod in K]</ref>▼
* <code>x</code> is the dividend and <code>y</code> is the divisor.
▲
▲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 19 ⟶ 22:
1 2 0 1 2 0 1 2 0 1 2 0
</pre>
== References ==
[[Category:Verbs]]
[[Category:Operator verbs]]
[[Category:Primitives]]
|