1// Copyright 2024 The Go Authors. All rights reserved. 2// Use of this source code is governed by a BSD-style 3// license that can be found in the LICENSE file. 4 5// Use of public API is ok. 6 7package main 8 9import ( 10 "iter" 11 "unique" 12) 13 14func seq(yield func(int) bool) { 15 yield(123) 16} 17 18var s = "hello" 19 20func main() { 21 h := unique.Make(s) 22 next, stop := iter.Pull(seq) 23 defer stop() 24 println(h.Value()) 25 println(next()) 26 println(next()) 27} 28