我们的下一个基于列表的递归函数示例要稍微复杂一些。
Our next example of a recursive function on lists will be a little more complicated.
后面将使用这个函数填充一个用户列表。
假定将任意参数列表传递给上面的函数。
Assume an arbitrary argument list is passed to the above function.
这个函数是1的无穷列表。
这是在网页上显示库存列表的函数。
This is the function that displays the returned inventory list on the Web page.
此函数还可用于未以逗号分隔的列表。
This function can also be used for lists that are not comma-delimited.
例如,函数通常从列表中挑选内容。
For example, frequently a function will want to pick apart the contents of a list.
列表4.在实体文件中为一个内联函数所生成的代码。
Listing 4. Generated Code for an inline function in body file.
测量实例1:函数列表视图。
第一个参数是keys,这是在map函数中创建的键的列表。
The first, keys, is a list of keys that were created in the map function.
distribute函数的第一个参数是一个列表。
(要获得受safe_mode更改影响的函数列表的链接,请参见参考资料)。
For a link to a list of the functions affected by this safe_mode change, see Resources.
为了获得列表的下一个节点,您需要使用cdr函数。
To retrieve the next node of a list, you need to use the function CDR.
清单9中的total函数将列表当作单个的参数。
The total function in Listing 9 takes a list as a single argument.
lambda的第一个参数是函数可以取得的参数列表。
The first argument to lambda is the list of arguments the function can take.
使用cons函数在Scheme中创建一个列表节点。
可以使用range()函数来生成一个整数列表。
The range() function can be used to generate a list of integers.
函数preg_grep还可以快速地过滤列表。
当然,map()函数、列表内涵(list-comprehension)和最近的生成器内涵(generator-comprehension 都可以让您实现elementwise应用。
Certainly the map() function, list-comprehensions, and more recently generator-comprehensions, let you do elementwise application.
度量还有一个应用于列或列表达式的聚合函数。
Measures also have an aggregation function applied to the column or column expression.
如果希望构建列表而不是将其分开,就需要构造函数。
If you want to build lists instead of taking them apart, you need constructors.
为纯虚函数所生成的代码如列表1 中所示。
The code generated for the pure virtual function is shown in Listing 1.
使用ROW和LIST构造函数创建字段列表。
load_biz _ rules的最后一行执行了一次列表推导(list comprehension),构建并返回一个函数列表。
The last line of load_biz_rules performs list comprehension to build and return a list of functions.
自定义函数列表长度的方案吗?
可以列表和变量从函数返回?
具有可变参数列表的函数(…)。
指数函数返回基于您提供的列表索引。
The Index function returns the index based upon the list you provide.
在本例中,匿名函数为列表的每个元素加1。
In this case, the anonymous function adds 1 to every element of a list.
在本例中,匿名函数为列表的每个元素加1。
In this case, the anonymous function adds 1 to every element of a list.
应用推荐