Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 3 of 3 for ClippedLargest (0.19 sec)

  1. test/typeparam/list.go

    type _ListNum[T OrderedNum] struct {
    	next *_ListNum[T]
    	val  T
    }
    
    const Clip = 5
    
    // ClippedLargest returns the largest in the list of OrderNums, but a max of 5.
    // Test use of untyped constant in an expression with a generically-typed parameter
    func (l *_ListNum[T]) ClippedLargest() T {
    	var max T
    	for p := l; p != nil; p = p.next {
    		if p.val > max && p.val < Clip {
    			max = p.val
    		}
    	}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Sat Dec 03 17:08:51 UTC 2022
    - 2.4K bytes
    - Viewed (0)
  2. test/typeparam/listimp.dir/main.go

    	j2 := &a.ListNum[int]{j3, 32}
    	j1 := &a.ListNum[int]{j2, 2}
    	if got, want := j1.ClippedLargest(), 2; got != want {
    		panic(fmt.Sprintf("got %d, want %d", got, want))
    	}
    	g3 := &a.ListNum[float64]{nil, 13.5}
    	g2 := &a.ListNum[float64]{g3, 1.2}
    	g1 := &a.ListNum[float64]{g2, 4.5}
    	if got, want := g1.ClippedLargest(), 4.5; got != want {
    		panic(fmt.Sprintf("got %f, want %f", got, want))
    	}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Mar 24 02:14:15 UTC 2022
    - 1.4K bytes
    - Viewed (0)
  3. test/typeparam/listimp.dir/a.go

    }
    
    // ListNum is a linked _List of ordered numeric values of type T.
    type ListNum[T OrderedNum] struct {
    	Next *ListNum[T]
    	Val  T
    }
    
    const Clip = 5
    
    // ClippedLargest returns the largest in the list of OrderNums, but a max of 5.
    func (l *ListNum[T]) ClippedLargest() T {
    	var max T
    	for p := l; p != nil; p = p.Next {
    		if p.Val > max && p.Val < Clip {
    			max = p.Val
    		}
    	}
    	return max
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Sat Dec 03 17:08:51 UTC 2022
    - 1.1K bytes
    - Viewed (0)
Back to top