键盘快捷键

使用 跳转章节

使用 S/ 在本书内搜索

使用 ? 显示帮助页面

使用 Esc 隐藏帮助页面

NDiv

NDiv[m, n]

Performs integer division of m by n, rounding toward negative infinity (floor division). This behavior ensures that NDiv and Mod together satisfy the identity:

Let[always_true, Fun[{ m, n }, Eq[Add[Mul[NDiv[m, n], n], Mod[m, n]], m]]];
always_true[7, -3]; (* => #t *)
always_true[-9, 2]; (* => #t *)
  • m and n should be integers.
  • Returns a Number representing the integer quotient.
NDiv[7, 3];   (* => 2 *)
NDiv[-7, 3];  (* => -3 *)

Neg

Neg[n]

Returns the negation (additive inverse) of n. Since KSL does not provide a unary minus operator, this function is used to obtain the opposite sign.

  • Returns a Number.
Neg[3];    (* => -3 *)
Neg[-5];   (* => 5 *)
Neg[0];    (* => 0 *)

Not

Not[b]

Returns the logical negation of a boolean value b.

  • b must be #t or #f.
  • Returns #t if b is #f, and #f if b is #t.
Not[#t];  (* => #f *)
Not[#f];  (* => #t *)