Skip to content
Legacy docs for Tenzir v5.x. For the latest Tenzir v6 series, visit docs.tenzir.com. Migrating from v5? Read the Tenzir v6 migration guide.

Removes all occurrences of an element from a list.

remove(xs:list, x:any) -> list

The remove function returns the list xs with all occurrences of x removed. If x is not present in the list, the original list is returned unchanged.

A list to remove elements from.

The value to remove from the list.

from {xs: [1, 2, 3, 2, 4]}
xs = xs.remove(2)
{xs: [1, 3, 4]}
from {xs: [1, 2, 3]}
xs = xs.remove(5)
{xs: [1, 2, 3]}
from {xs: ["apple", "banana", "apple", "orange"]}
xs = xs.remove("apple")
{xs: ["banana", "orange"]}

Last updated: