Mod: Difference between revisions

From The K Language Wiki
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...")
 
(move outside links to citations)
Line 1: Line 1:
{{primitive|x!y}}
{{primitive|x!y}}
The '''Mod''', '''Modulo''', '''Remainder''' or '''Residue''' (see [https://aplwiki.com/wiki/Residue APL])) function, denoted by <code>!</code>, is used for modulo in K.
The '''Mod''', '''Modulo''', '''Remainder''' or '''Residue'''<ref>https://aplwiki.com/wiki/Residue</ref>) function, denoted by <code>!</code>, is used for modulo in K.

Up until the K4 dialect, the modulo operator was [[Atomicity|left atomic]] on account of the [[rotate]] overload.

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>


<pre>
<pre>
Line 15: Line 19:
1 2 0 1 2 0 1 2 0 1 2 0
1 2 0 1 2 0 1 2 0 1 2 0
</pre>
</pre>
== References ==

== History ==


[https://chat.stackexchange.com/transcript/message/58587397#58587397 JohnEarnest on the order of arguments for mod in K]

Revision as of 11:33, 11 July 2021

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 operator was left atomic on account of the rotate overload.

From K5 onward, the modulo primitive is 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

References