Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 4 of 4 for SortedFunc (0.11 sec)

  1. doc/next/6-stdlib/3-iter.md

    - [AppendSeq](/pkg/slices#AppendSeq) appends values from an iterator to
      an existing slice.
    - [Sorted](/pkg/slices#Sorted) collects values from an iterator into a
      new slice, and then sorts the slice.
    - [SortedFunc](/pkg/slices#SortedFunc) is like `Sorted` but with a
      comparison function.
    - [SortedStableFunc](/pkg/slices#SortedStableFunc) is like `SortFunc`
      but uses a stable sort algorithm.
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon May 20 18:34:13 UTC 2024
    - 1.4K bytes
    - Viewed (0)
  2. src/slices/iter.go

    // and returns it.
    func Sorted[E cmp.Ordered](seq iter.Seq[E]) []E {
    	s := Collect(seq)
    	Sort(s)
    	return s
    }
    
    // SortedFunc collects values from seq into a new slice, sorts the slice
    // using the comparison function, and returns it.
    func SortedFunc[E any](seq iter.Seq[E], cmp func(E, E) int) []E {
    	s := Collect(seq)
    	SortFunc(s, cmp)
    	return s
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon May 13 21:40:32 UTC 2024
    - 2.9K bytes
    - Viewed (0)
  3. src/slices/iter_test.go

    }
    
    func TestSorted(t *testing.T) {
    	s := Sorted(Values(ints[:]))
    	if !IsSorted(s) {
    		t.Errorf("sorted %v", ints)
    		t.Errorf("   got %v", s)
    	}
    }
    
    func TestSortedFunc(t *testing.T) {
    	s := SortedFunc(Values(ints[:]), func(a, b int) int { return a - b })
    	if !IsSorted(s) {
    		t.Errorf("sorted %v", ints)
    		t.Errorf("   got %v", s)
    	}
    }
    
    func TestSortedStableFunc(t *testing.T) {
    	n, m := 1000, 100
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri May 10 17:28:50 UTC 2024
    - 5.7K bytes
    - Viewed (0)
  4. api/go1.23.txt

    pkg slices, func Collect[$0 interface{}](iter.Seq[$0]) []$0 #61899
    pkg slices, func Repeat[$0 interface{ ~[]$1 }, $1 interface{}]($0, int) $0 #65238
    pkg slices, func SortedFunc[$0 interface{}](iter.Seq[$0], func($0, $0) int) []$0 #61899
    pkg slices, func SortedStableFunc[$0 interface{}](iter.Seq[$0], func($0, $0) int) []$0 #61899
    pkg slices, func Sorted[$0 cmp.Ordered](iter.Seq[$0]) []$0 #61899
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Jun 05 20:48:49 UTC 2024
    - 8.4K bytes
    - Viewed (0)
Back to top