跳转到内容

This page is also in English.

Read it in English

Esta página también está en español.

Léela en español

このページは日本語でも読めます。

日本語で読む

fold_list 函数

fold 的各个步骤:从初始值开始的每一个中间结果。

怎么写

fold_list(f, start, list)

f
接受两个参数的函数。接受一个函数。
start
初始值。接受一个表达式。
list
要结合的元素。接受一个列表。

示例

  • fold_list⁡(plus⁡,0,[1,2,3])=[0,1,3,6]\displaystyle \operatorname{fold\_list}(\operatorname{plus}, 0, \left[ 1, 2, 3 \right]) = \left[ 0, 1, 3, 6 \right]
    fold_list(plus, 0, [1, 2, 3])

    在求解器中,fold_list(plus, 0, [1, 2, 3]) 的结果是 [0, 1, 3, 6]。

    在求解器中打开
  • fold

    从左侧开始,用函数把列表的元素逐步结合,并从某个值出发。

  • list

    由参数构成的列表。

  • nest_list

    nest 的各个步骤:每次应用后的值,从第一次开始。

  • head

    表达式的头部:它所调用的函数的名称。

  • intersection

    同时属于若干个列表的所有元素。

  • flatten

    把嵌套列表展平为一个列表。