Files
lo/docs/data/it-fromseqptr.md
T
Samuel Berthe fa095e4b4f fix(doc): fix go playground demo URL (#832)
* fix(doc): fix go playground demo URL

* fix(doc): add more go playground demo URL
2026-03-06 00:09:59 +01:00

728 B

name, slug, sourceRef, category, subCategory, signatures, variantHelpers, playUrl, similarHelpers, position
name slug sourceRef category subCategory signatures variantHelpers playUrl similarHelpers position
FromSeqPtr fromseqptr it/type_manipulation.go#L11 it type
func FromSeqPtr[T any](collection iter.Seq[*T]) iter.Seq[T]
it#type#fromseqptror
https://go.dev/play/p/_eO6scpLcBF
core#type#fromptr
241

FromSeqPtr returns a sequence with the pointer values. Returns a zero value in case of a nil pointer element.

one := 1
two := 2
var three *int = nil

collection := func(yield func(*int) bool) {
    yield(&one)
    yield(&two)
    yield(three)
}

values := it.FromSeqPtr(collection)
var result []int
for val := range values {
    result = append(result, val)
}
// result contains [1, 2, 0]