Skip to content

Slicing last n elements using count returns empty array #6630

@Mc-Zen

Description

@Mc-Zen

Description

When slicing an array with a negative start and a count such that the last count elements are sliced, the returned array is empty.

Example:

#{
  let s1 = (1,2,3,4).slice(-3, count: 2) // (2, 3)
  let s2 = (1,2,3,4).slice(-2, count: 2) // ()
}

Reproduction URL

No response

Operating system

No response

Typst version

  • I am using the latest version of Typst

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingscriptingAbout Typst's coding capabilities

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions