Macaulay2 » Documentation
Packages » Macaulay2Doc :: applyTable
next | previous | forward | backward | up | index | toc

applyTable -- apply a function to each element of a table

Synopsis

Description

i1 : t = table({1,3,5,7}, {0,1,2,4}, (i,j) -> i^j);
i2 : netList t

     +-+-+--+----+
o2 = |1|1|1 |1   |
     +-+-+--+----+
     |1|3|9 |81  |
     +-+-+--+----+
     |1|5|25|625 |
     +-+-+--+----+
     |1|7|49|2401|
     +-+-+--+----+
i3 : netList applyTable(t, i -> 2*i)

     +-+--+--+----+
o3 = |2|2 |2 |2   |
     +-+--+--+----+
     |2|6 |18|162 |
     +-+--+--+----+
     |2|10|50|1250|
     +-+--+--+----+
     |2|14|98|4802|
     +-+--+--+----+
i4 : netList applyTable(t, isPrime)

     +-----+-----+-----+-----+
o4 = |false|false|false|false|
     +-----+-----+-----+-----+
     |false|true |false|false|
     +-----+-----+-----+-----+
     |false|true |false|false|
     +-----+-----+-----+-----+
     |false|true |false|false|
     +-----+-----+-----+-----+

See also

For the programmer

The object applyTable is a function closure.