Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 1,264 for splices (0.16 sec)

  1. src/slices/slices.go

    	panic("needle not found")
    }
    
    // Reverse reverses the elements of the slice in place.
    func Reverse[S ~[]E, E any](s S) {
    	for i, j := 0, len(s)-1; i < j; i, j = i+1, j-1 {
    		s[i], s[j] = s[j], s[i]
    	}
    }
    
    // Concat returns a new slice concatenating the passed in slices.
    func Concat[S ~[]E, E any](slices ...S) S {
    	size := 0
    	for _, s := range slices {
    		size += len(s)
    		if size < 0 {
    			panic("len out of range")
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Apr 29 14:01:59 UTC 2024
    - 13.6K bytes
    - Viewed (0)
  2. pkg/slices/slices.go

    // limitations under the License.
    
    // Package slices defines various functions useful with slices of any type.
    package slices
    
    import (
    	"cmp"
    	"slices" // nolint: depguard
    	"strings"
    
    	"golang.org/x/exp/constraints"
    )
    
    // Equal reports whether two slices are equal: the same length and all
    // elements equal. If the lengths are different, Equal returns false.
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Wed May 15 06:28:11 UTC 2024
    - 7.9K bytes
    - Viewed (0)
  3. src/go/parser/testdata/slices.go2

    // Package slices implements various slice algorithms.
    package slices
    
    // Map turns a []T1 to a []T2 using a mapping function.
    func Map[T1, T2 any](s []T1, f func(T1) T2) []T2 {
    	r := make([]T2, len(s))
    	for i, v := range s {
    		r[i] = f(v)
    	}
    	return r
    }
    
    // Reduce reduces a []T1 to a single value using a reduction function.
    func Reduce[T1, T2 any](s []T1, initializer T2, f func(T2, T1) T2) T2 {
    	r := initializer
    	for _, v := range s {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Nov 24 19:44:06 UTC 2020
    - 666 bytes
    - Viewed (0)
  4. staging/src/k8s.io/apimachinery/pkg/runtime/splice.go

    */
    
    package runtime
    
    import (
    	"bytes"
    	"io"
    )
    
    // Splice is the interface that wraps the Splice method.
    //
    // Splice moves data from given slice without copying the underlying data for
    // efficiency purpose. Therefore, the caller should make sure the underlying
    // data is not changed later.
    type Splice interface {
    	Splice([]byte)
    	io.Writer
    	Reset()
    	Bytes() []byte
    }
    
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Mon Jun 05 18:03:48 UTC 2023
    - 1.7K bytes
    - Viewed (0)
  5. src/cmd/compile/internal/syntax/testdata/slices.go

    // Copyright 2019 The Go Authors. All rights reserved.
    // Use of this source code is governed by a BSD-style
    // license that can be found in the LICENSE file.
    
    // Package slices implements various slice algorithms.
    package slices
    
    // Map turns a []T1 to a []T2 using a mapping function.
    func Map[T1, T2 any](s []T1, f func(T1) T2) []T2 {
    	r := make([]T2, len(s))
    	for i, v := range s {
    		r[i] = f(v)
    	}
    	return r
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Mar 30 18:02:18 UTC 2022
    - 1.5K bytes
    - Viewed (0)
  6. src/internal/types/testdata/check/slices.go

    // Copyright 2019 The Go Authors. All rights reserved.
    // Use of this source code is governed by a BSD-style
    // license that can be found in the LICENSE file.
    
    // Package slices implements various slice algorithms.
    package slices
    
    // Map turns a []T1 to a []T2 using a mapping function.
    func Map[T1, T2 any](s []T1, f func(T1) T2) []T2 {
    	r := make([]T2, len(s))
    	for i, v := range s {
    		r[i] = f(v)
    	}
    	return r
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Jan 17 19:54:25 UTC 2023
    - 1.5K bytes
    - Viewed (0)
  7. src/internal/trace/traceviewer/static/trace_viewer_full.html

    index++;oldIndex++;break;case EDIT_UPDATE:if(!splice)
    splice=newSplice(index,[],0);splice.addedCount++;index++;splice.removed.push(old[oldIndex]);oldIndex++;break;case EDIT_ADD:if(!splice)
    splice=newSplice(index,[],0);splice.addedCount++;index++;break;case EDIT_DELETE:if(!splice)
    splice=newSplice(index,[],0);splice.removed.push(old[oldIndex]);oldIndex++;break;}}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Nov 21 20:45:06 UTC 2023
    - 2.5M bytes
    - Viewed (1)
  8. test/typeparam/slices.go

    }
    
    // _Min returns the minimum element in a slice of some ordered type.
    // If the slice is empty it returns the zero value of the element type.
    func _SliceMin[Elem Ordered](s []Elem) Elem {
    	if len(s) == 0 {
    		var zero Elem
    		return zero
    	}
    	return _Reduce(s[1:], s[0], _Min[Elem])
    }
    
    // _Append adds values to the end of a slice, returning a new slice.
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Mar 01 19:45:34 UTC 2022
    - 7.8K bytes
    - Viewed (0)
  9. src/runtime/slice.go

    //
    // Do not remove or change the type signature.
    // See go.dev/issue/67401.
    //
    //go:linkname reflect_growslice reflect.growslice
    func reflect_growslice(et *_type, old slice, num int) slice {
    	// Semantically equivalent to slices.Grow, except that the caller
    	// is responsible for ensuring that old.len+num > old.cap.
    	num -= old.cap - old.len // preserve memory of old[old.len:old.cap]
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed May 29 16:25:21 UTC 2024
    - 12.2K bytes
    - Viewed (0)
  10. src/sort/slice.go

    //
    // Note: in many situations, the newer [slices.SortFunc] function is more
    // ergonomic and runs faster.
    func Slice(x any, less func(i, j int) bool) {
    	rv := reflectlite.ValueOf(x)
    	swap := reflectlite.Swapper(x)
    	length := rv.Len()
    	limit := bits.Len(uint(length))
    	pdqsort_func(lessSwap{less, swap}, 0, length, limit)
    }
    
    // SliceStable sorts the slice x using the provided less
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Nov 28 16:40:32 UTC 2023
    - 1.8K bytes
    - Viewed (0)
Back to top