package list
import "cuelang.org/go/pkg/list"
Package list contains functions for manipulating and examining lists.
Index ¶
- func Avg(xs []*internal.Decimal) (*internal.Decimal, error)
- func Contains(a []cue.Value, v cue.Value) bool
- func Drop(x []cue.Value, n int) ([]cue.Value, error)
- func Max(xs []*internal.Decimal) (*internal.Decimal, error)
- func MaxItems(a []cue.Value, n int) bool
- func Min(xs []*internal.Decimal) (*internal.Decimal, error)
- func MinItems(a []cue.Value, n int) bool
- func Product(xs []*internal.Decimal) (*internal.Decimal, error)
- func Slice(x []cue.Value, i, j int) ([]cue.Value, error)
- func Sum(xs []*internal.Decimal) (*internal.Decimal, error)
- func Take(x []cue.Value, n int) ([]cue.Value, error)
- func UniqueItems(a []cue.Value) bool
Functions ¶
func Avg ¶
Avg returns the average value of a non empty list xs.
func Contains ¶
Contains reports whether v is contained in a. The value must be a comparable value.
func Drop ¶
Drop reports the suffix of list x after the first n elements, or [] if n > len(x).
For instance:
Drop([1, 2, 3, 4], 2)
results in
[3, 4]
func Max ¶
Max returns the maximum value of a non empty list xs.
func MaxItems ¶
MaxItems reports whether a has at most n items.
func Min ¶
Min returns the minimum value of a non empty list xs.
func MinItems ¶
MinItems reports whether a has at least n items.
func Product ¶
Product returns the product of a non empty list xs.
func Slice ¶
Slice extracts the consecutive elements from list x starting from position i up till, but not including, position j, where 0 <= i < j <= len(x).
For instance:
Slice([1, 2, 3, 4], 1, 3)
results in
[2, 3]
func Sum ¶
Sum returns the sum of a list non empty xs.
func Take ¶
Take reports the prefix of length n of list x, or x itself if n > len(x).
For instance:
Take([1, 2, 3, 4], 2)
results in
[1, 2]
func UniqueItems ¶
UniqueItems reports whether all elements in the list are unique.
Source Files ¶
list.go math.go
- Version
- v0.0.11
- Published
- Sep 13, 2019
- Platform
- windows/amd64
- Imports
- 5 packages
- Last checked
- 6 minutes ago –
Tools for package owners.