Skip to content

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

Léela en español

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

日本語で読む

本页也有简体中文版本。

阅读简体中文版本

rotate_left function

A list with its elements moved to the left, the first ones going to the end.

How to write it

rotate_left(list)

One place.

list
The list. Takes a list.

rotate_left(list, n)

Several places.

list
The list. Takes a list.
n
How many places. Takes a whole number.

Examples

  • rotate_left⁡([1,2,3])=[2,3,1]\displaystyle \operatorname{rotate\_left}(\left[ 1, 2, 3 \right]) = \left[ 2, 3, 1 \right]
    rotate_left([1, 2, 3])

    In the solver, rotate_left([1, 2, 3]) gives [2, 3, 1].

    Open in the solver
  • rotate_left⁡([1,2,3],2)=[3,1,2]\displaystyle \operatorname{rotate\_left}(\left[ 1, 2, 3 \right], 2) = \left[ 3, 1, 2 \right]
    rotate_left([1, 2, 3], 2)

    In the solver, rotate_left([1, 2, 3], 2) gives [3, 1, 2].

    Open in the solver
  • rotate_right

    A list with its elements moved to the right, the last ones going to the front.

  • riffle

    A list with a value put between its elements.

  • select

    The elements of a list for which a test holds.

  • reverse

    A list in reverse order.

  • sort

    A list in increasing order.

  • rest

    A list without its first element.