pkg/eval: Clarify that "count" works for containers in general.

Also include the word "length" to make it slightly easier to find.
This commit is contained in:
Qi Xiao 2024-06-05 21:26:41 +01:00
parent e62ba90e37
commit 1e3549f97f

View File

@ -156,21 +156,24 @@ fn drop {|n inputs?| }
# ```
fn compact {|inputs?| }
# Count the number of inputs.
# Count the number of elements in a container (also known as its _length_), or
# the number of inputs when when argument is given.
#
# Examples:
#
# ```elvish-transcript
# ~> count lorem # count bytes in a string
# ▶ (num 5)
# ~> count [lorem ipsum]
# ▶ (num 2)
# ~> range 100 | count
# ~> count [&foo=bar &lorem=ipsum] # count pairs in a map
# ▶ (num 2)
# ~> count lorem # count bytes in a string
# ▶ (num 5)
# ~> range 100 | count # count inputs
# ▶ (num 100)
# ~> seq 100 | count
# ▶ (num 100)
# ```
fn count {|input-list?| }
fn count {|inputs?| }
# Outputs the [value inputs](#value-inputs) after sorting. The sorting process
# is