length

Built-ins

Canonical ID: core.length. Nederlands: lengte.

Counts Unicode code points in Text, top-level elements in a List, or entries in a Map. It does not count UTF-8 bytes or recursively count nested values. A visible emoji may contain several code points. Other value types are rejected; convert a number to text first only if you intend to count its displayed characters.

Signature

length(value)

Arguments

Parameter Type Requirement
value Text / List / Map The value to count.

Return value

Number.

Example

# language: en
say length("🐢abc")
say length([1, [2, 3]])
say length({"a": 1, "b": 2})

Prints 4, 2, and 2.

Notes and common mistakes

Use the function name for your source language. Its canonical ID is a shared documentation label; you do not type that ID as a call. Giving your own variable or function the same name can hide the built-in. Supply the documented arguments and value types. Pliro reports mismatches when checking can detect them, or when the call runs.

say · text · Programming guides · Host support · Calls and arguments