Negate: Difference between revisions

From The K Language Wiki
Content added Content deleted
(add negate page)
 
("Paragraph cleanup")
 
(8 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{primitive|-x}}

The '''negate''' function, generally denoted by <code>-</code>, is used for getting the additive inverse of a number in K(numeric negation).
The '''negate''' function, generally denoted by <code>-</code>, is used for getting the additive inverse of a number in K(numeric negation).


When applied directly to a numeric literal, <code>-</code> should be followed by a space to prevent it from becoming the sign of its first item.


The negate primitive is [[Atomicity|right atomic.]]<pre>
The negate primitive is [[Atomicity|right atomic.]]<pre>
Line 6: Line 9:
-3
-3


-(9;8;7)
- 9 8 7
-9 -8 -7
-9 -8 -7


Line 14: Line 17:
-7 65)
-7 65)
</pre>
</pre>

[[Category:Verbs]]
[[Category:Operator verbs]]
[[Category:Primitives]]

Latest revision as of 07:59, 9 July 2022

Negate
-x

The negate function, generally denoted by -, is used for getting the additive inverse of a number in K(numeric negation).

When applied directly to a numeric literal, - should be followed by a space to prevent it from becoming the sign of its first item.

The negate primitive is right atomic.

 -[3]
-3

 - 9 8 7
-9 -8 -7

 -(9;(8;-56);(7;-65))
(-9
 -8 56
 -7 65)