Iota函数 - 维基百科,自由的百科全书

iota函数计算机语言中的一个函数,用于产生连续的值。

提供该函数的语言

[编辑]

APL

[编辑]

写作,产生从1到N的连续整数,即 1、2、3、……、N。

C++11起提供,位于<numeric>库。

#include <iostream> #include <vector> #include <numeric>  std::vector<char> vch(26); std::iota(vch.begin(), vch.end(), 'a'); for(char ch: vch){   std::cout<<ch;//abcdefghijklmnopqrstuvwxyz } 

在 System.Linq.Enumerable(以及ParallelEnumerable)中。

Dim vi As New List(Of Integer)(System.Linq.Enumerable.Range(5, 6)) For Each i As Integer In vi   System.Diagnostics.Debug.WriteLine(i)'5 6 7 8 9 10 Next i