Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions transform.go
Original file line number Diff line number Diff line change
@@ -1,22 +1,11 @@
package weaklinq

import "iter"

//----------------------------------------------------------------------------//
// Transform //
//----------------------------------------------------------------------------//

////////////////////////////////////////////////////////////////////////////////

// Iterable is the base structure for an iterable. It allows for the lazy
// iteration of a collection of items and exists to allow functions to be
// called on the collection.
type Iterable[T any] struct {
iter.Seq[T]
}

////////////////////////////////////////////////////////////////////////////////

// GetThese returns a new Iterable where the items are transformed by selector.
func (iterable Iterable[T]) GetThese(selector func(T) any) Iterable[any] {

Expand Down
12 changes: 12 additions & 0 deletions weakLinq.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package weaklinq

import (
"fmt"
"iter"
"reflect"
"slices"
)
Expand All @@ -12,6 +13,17 @@ import (

////////////////////////////////////////////////////////////////////////////////

// Iterable is the base structure for an iterable. It allows for the lazy
// iteration of a collection of items and exists to allow functions to be
// called on the collection.
type Iterable[T any] struct {
iter.Seq[T]
}

////////////////////////////////////////////////////////////////////////////////

// identitySelector is a function that returns the item passed to it. Used as
// the default selector for many functions.
func identitySelector[T any](item T) any {
return item
}
Expand Down