tabulate

sknano.core.tabulate(function, start=0)[source] [edit on github][source]

Return an iterator mapping function over linear input.

Returns function(0), function(1), ...

Parameters:
  • function (callable) –
  • start (int) – The start argument will be increased by 1 each time the iterator is called and fed into function.
Returns:

Return type:

Iterator

Examples

>>> from sknano.core import tabulate, ordinal_form, take
>>> t = tabulate(ordinal_form, 10)
>>> take(5, t)
['10th', '11th', '12th', '13th', '14th']
>>> take(5, t)
['15th', '16th', '17th', '18th', '19th']
>>> t = tabulate(ordinal_form)
>>> take(5, t)
['0th', '1st', '2nd', '3rd', '4th']
>>> take(5, t)
['5th', '6th', '7th', '8th', '9th']