Negate: Difference between revisions

From The K Language Wiki
Content added Content deleted
(add negate page)
 
(sign vs negate)
Line 1:
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 list literal, <code>-</code> should be followed by a space to prevent it from becoming sign of the first item.
 
The negate primitive is [[Atomicity|right atomic.]]<pre>
Line 6 ⟶ 7:
-3
 
-( 9; 8; 7)
-9 -8 -7
 

Revision as of 16:07, 8 July 2021

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 list literal, - should be followed by a space to prevent it from becoming sign of the 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)