Skip to content

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

Léela en español

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

日本語で読む

本页也有简体中文版本。

阅读简体中文版本

map_thread function

Apply a function to corresponding elements of several lists.

How to write it

map_thread(f, lists)

f
The function to apply. Takes a function.
lists
A list of lists of the same length. Takes a list.

Examples

  • map_thread⁡(plus⁡,(1234))=[4,6]\displaystyle \operatorname{map\_thread}\left(\operatorname{plus}, \begin{pmatrix} 1 & 2 \\ 3 & 4 \end{pmatrix}\right) = \left[ 4, 6 \right]
    map_thread(plus, [[1, 2], [3, 4]])

    In the solver, map_thread(plus, [[1, 2], [3, 4]]) gives [4, 6].

    Open in the solver
  • map

    Apply a function to every element of a list.

  • thread

    Apply a function to corresponding elements of lists.

  • most

    A list without its last element.

  • nest

    Apply a function again and again to a value.

  • list

    A list of the arguments.

  • nest_list

    The steps of nest: the value after each application, starting from the first.