1// compile 2 3// Copyright 2024 The Go Authors. All rights reserved. 4// Use of this source code is governed by a BSD-style 5// license that can be found in the LICENSE file. 6 7package p 8 9type Iterator[A any] func() (bool, A) 10 11type Range[A any] interface { 12 Blocks() Iterator[Block[A]] 13} 14 15type Block[A any] interface { 16 Range[A] 17} 18 19type rangeImpl[A any] struct{} 20 21func (r *rangeImpl[A]) Blocks() Iterator[Block[A]] { 22 return func() (bool, Block[A]) { 23 var a Block[A] 24 return false, a 25 } 26} 27 28func NewRange[A any]() Range[A] { 29 return &rangeImpl[A]{} 30} 31 32type AddrImpl struct{} 33 34var _ = NewRange[AddrImpl]() 35