Standard library / slices

slices.AppendSeq()

Appends sequence elements to a slice; may reuse capacity. Retain the returned slice. Expected stdout: '[1 2 3]\n'.

Formal Syntax & Structure

go syntaxgo
func AppendSeq[Slice ~[]E, E any](s Slice, seq iter.Seq[E]) Slice

Parameters & Attributes

NameTypeDescription
sSliceInput slice; may share its backing array.
seqiter.Seq[E]Iterator function producing the input sequence.

Return Value

Slice

Appends sequence elements to a slice; may reuse capacity. Retain the returned slice.

Working Example

Example Snippetgo
package main
import (  "fmt"  "slices")
func main() {  fmt.Println(slices.AppendSeq([]int{1}, slices.Values([]int{2, 3})))}
Go Reference