Skip to content

Table ​

An alias for Tabulate (the preferred name) that additionally accepts Mathematica-style iterator specs, e.g. Table(i^2, {i, 1, n}), and the equivalent tuple spelling Table(i^2, (i, 1, n)).

✓ checked against that system · ! checked, with disagreements (hover a chip)FungrimTableWolfram LanguageTable✓
Table(expr, {i, lo, hi})[expr]i=lohi[expr]_{i=lo}^{hi}, exprexpr evaluated at each value of ii from lolo to hihi.
Table(expr, {i, lo, hi, step})as above, stepping by stepstep instead of 1.
Table(f, n)the same as Tabulate(f, n) — ff applied to each index from 1 to nn.
Typed signatures
TypePackageApplies
(function, integer, integer?) -> collectioncompute-enginealways

Domain: Collections

Details
  • {i, lo, hi} is [Set, i, lo, hi] in MathJSON, read here as an iterator spec rather than a set.
  • Holds its body: exprexpr is evaluated fresh at each value of ii, not evaluated once and reused.

Examples

Basic #

Table of i2i^2 for ii from 1 to 5

live ↗
InTable(i2,{i,1,5})\mathrm{Table}(i^2, \lbrace i, 1, 5\rbrace)Out[1,4,9,16,25]\bigl\lbrack1, 4, 9, 16, 25\bigr\rbrack

Odd numbers from 1 to 9, stepping by 2

live ↗
InTable(i,{i,1,10,2})\mathrm{Table}(i, \lbrace i, 1, 10, 2\rbrace)Out[1,3,5,7,9]\bigl\lbrack1, 3, 5, 7, 9\bigr\rbrack

Tabulating a bare symbol applies it to each index

live ↗
InTabulate(x,10)\mathrm{Tabulate}(x, 10)Out[x(1),x(2),x(3),x(4),x(5),x(6),x(7),x(8),x(9),x(10)]\bigl\lbrack x(1), x(2), x(3), x(4), x(5), x(6), x(7), x(8), x(9), x(10)\bigr\rbrack
Scope #

The same shape of table with a plain function, like Tabulate

live ↗
InTable(_1⁡↦_1⁡2,5)\mathrm{Table}(\operatorname{\_1}↦\operatorname{\_1}^2, 5)Out[1,4,9,16,25]\bigl\lbrack1, 4, 9, 16, 25\bigr\rbrack
Properties #

A constant body is still evaluated once per index

live ↗
InTable(0,{i,1,3})\mathrm{Table}(0, \lbrace i, 1, 3\rbrace)Out[0,0,0]\bigl\lbrack0, 0, 0\bigr\rbrack
About
Examples5
Checked againstWolfram Language 2 agree
CrosswalkFungrimWolfram Language

See also: Tabulate, Map