键盘快捷键

使用 跳转章节

使用 S/ 在本书内搜索

使用 ? 显示帮助页面

使用 Esc 隐藏帮助页面

Many

Many[value, count]

Constructs a list consisting of value repeated count times.

  • Returns a List containing count copies of value.
Many["a", 3];  (* => {"a", "a", "a"} *)
Many[0, 5];    (* => {0, 0, 0, 0, 0} *)

Map

Map[list, fun]

Applies the function fun to each element of list and returns a new list containing the results.

  • Returns a List with the same length as the input.
Map[{ 1, 2, 3 }, Fun[{ x }, Add[x, 3]]];  (* => {4, 5, 6} *)
Map[{ "a", "b" }, Fun[{ s }, Concat[s, "!"] ]];  (* => {"a!", "b!"} *)

Max

Max[a, b]

Returns the larger of two numbers a and b.

  • Returns a Number.
Max[10, 20];      (* => 20 *)
Max[-5, -10];     (* => -5 *)
Max[Exp[ArcTan2[-1, 0]], Power[ArcTan2[-1, 0], Exp[1]]];  (* => 23.1406926327793 *)

Min

Min[a, b]

Returns the smaller of two numbers a and b.

  • Returns a Number.
Min[10, 20];      (* => 10 *)
Min[-5, -10];     (* => -10 *)
Min[Exp[ArcTan2[-1, 0]], Power[ArcTan2[-1, 0], Exp[1]]];  (* => 22.459157718361 *)

Mkdir

Mkdir[path]

Mkdir[path, is_rec]

Creates a new directory at the specified path.

  • If is_rec is #t, creates parent directories as needed (equivalent to mkdir -p).
  • Returns Unit[].
Mkdir["new_dir"];                (* Creates a single directory *)
Mkdir["path/to/nested/dir", #t]; (* Creates all missing parent directories *)

Mod

Mod[n, p]

Computes the mathematical modulo of n with respect to p. Unlike remainder (Rem), the result always has the same sign as the divisor p.

  • Returns a Number.
Mod[10, 3];   (* => 1 *)
Mod[10, -3];  (* => -2 *)
Mod[-10, 3];  (* => 2 *)

Module

Module[name]

Declares the current file as a module with the given name. May appear at most once per file, at any position.

  • name is a String identifying the module.
  • Returns Unit[].
Module["main"];

Mul

Mul[n1, n2, ...]

Computes the product of one or more numbers. If only one argument is provided, that argument is returned unchanged.

  • Returns a Number.
Mul[10, 20, 3];  (* => 600 *)
Mul[2.5, 4];     (* => 10 *)
Mul[42];         (* => 42 *)
Mul[2, 3, Mul[4, 5]];  (* => 120 *)