Skip to content
/ piter Public

Pipeline and Fun-Out/In patterns using the iter package

License

Notifications You must be signed in to change notification settings

yyyoichi/piter

Repository files navigation

piter

Pipeline and Fun-Out/In patterns using the iter package

install

go get "github.com/yyyoichi/piter"

How to use

func main() {
    var strSrc iter.Seq[string] = func(yield func(string) bool) {
        _ = yield("1")
        _ = yield("2")
        _ = yield("a")
        _ = yield("10")
    }
    var ns = make([]int, 0, 4)
    for n, err := range piter.Pipeline12(ctx, strSrc, strconv.Atoi) {
        if err != nil {
            break
        }
        ns = append(ns, n)
    }
    for _, n := range ns {
        fmt.Println(n)
    } 

    // Output:
    // 1
    // 2
}

About

Pipeline and Fun-Out/In patterns using the iter package

Topics

Resources

License

Stars

Watchers

Forks

Languages