collections_doc.md

January 24, 2025 ยท View on GitHub

Skylib module containing functions that operate on collections.

collections.after_each

load("@bazel_skylib//lib:collections.bzl", "collections")

collections.after_each(separator, iterable)

Inserts separator after each item in iterable.

PARAMETERS

NameDescriptionDefault Value
separatorThe value to insert after each item in iterable.none
iterableThe list into which to intersperse the separator.none

RETURNS

A new list with separator after each item in iterable.

collections.before_each

load("@bazel_skylib//lib:collections.bzl", "collections")

collections.before_each(separator, iterable)

Inserts separator before each item in iterable.

PARAMETERS

NameDescriptionDefault Value
separatorThe value to insert before each item in iterable.none
iterableThe list into which to intersperse the separator.none

RETURNS

A new list with separator before each item in iterable.

collections.uniq

load("@bazel_skylib//lib:collections.bzl", "collections")

collections.uniq(iterable)

Returns a list of unique elements in iterable.

Requires all the elements to be hashable.

PARAMETERS

NameDescriptionDefault Value
iterableAn iterable to filter.none

RETURNS

A new list with all unique elements from iterable.