跳转到内容

This page is also in English.

Read it in English

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

Léela en español

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

日本語で読む

thread 函数

把函数应用到列表的对应元素上。

怎么写

thread(call)

call
一个调用,其参数是长度相同的列表。接受一个表达式。

示例

  • thread⁡(f([1,2],[3,4]))=[f(1,3),f(2,4)]\displaystyle \operatorname{thread}(f(\left[ 1, 2 \right], \left[ 3, 4 \right])) = \left[ f(1, 3), f(2, 4) \right]
    thread(f([1, 2], [3, 4]))

    在求解器中,thread(f([1, 2], [3, 4])) 的结果是 [f(1, 3), f(2, 4)]。

    在求解器中打开
  • map_thread

    对多个列表中对应的元素应用一个函数。

  • total

    列表元素之和。

  • tally

    每个元素出现的次数:元素与计数对的列表。

  • union

    出现在任意一个列表中的元素,每个只出现一次,按顺序。

  • take

    列表的前几个元素。

  • accumulate

    列表的累计总和。