constant

constant, function

def pure constant(a: number): zedfunc

Returns the zedfunc representing the constant function $f: x \mapsto a$.

Examples

f = constant(3)

show table "Constant" with
  valueAt(f, -1) as "k=-1"
  valueAt(f, 0) as "k=0"
  valueAt(f, 1) as "k=1"

Output:

k=-1 k=0 k=1
3 3 3

Remarks

The constant() function is unrelated to the const keyword, which controls compile-time evaluation.

User Contributed Notes
0 notes + add a note