Documentation
¶
Index ¶
- func FoldLeft[A, B any](l *LinkedList[A], z B, f func(B, A) B) B
- func FoldRight[A, B any](l *LinkedList[A], z B, f func(A, B) B) B
- func Head[T any](l *LinkedList[T]) T
- func Len[T any](l *LinkedList[T]) int
- func ToArray[A any](l *LinkedList[A]) []A
- type LinkedList
- func AddLast[T any](h T, l *LinkedList[T]) *LinkedList[T]
- func AddWhile[T any](l *LinkedList[T], p func(T) bool) *LinkedList[T]
- func Drop[T any](l *LinkedList[T], n int) *LinkedList[T]
- func Filter[T any](l *LinkedList[T], p func(T) bool) *LinkedList[T]
- func Push[T any](h T, l *LinkedList[T]) *LinkedList[T]
- func Tail[T any](l *LinkedList[T]) (*LinkedList[T], error)
- func ToList[T any](xs []T) *LinkedList[T]
- func Zero[T any]() *LinkedList[T]
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FoldLeft ¶
func FoldLeft[A, B any](l *LinkedList[A], z B, f func(B, A) B) B
func FoldRight ¶
func FoldRight[A, B any](l *LinkedList[A], z B, f func(A, B) B) B
func Len ¶
func Len[T any](l *LinkedList[T]) int
func ToArray ¶
func ToArray[A any](l *LinkedList[A]) []A
Types ¶
type LinkedList ¶
type LinkedList[T any] struct { // contains filtered or unexported fields }
func AddLast ¶
func AddLast[T any](h T, l *LinkedList[T]) *LinkedList[T]
func AddWhile ¶
func AddWhile[T any](l *LinkedList[T], p func(T) bool) *LinkedList[T]
Evaluates elements of given list, adding elements to head of a new list until predicate returns false, returning the new list and preserving ordering of original list. Note that this is different than filter. The algorithm stops appending to the resulting list when the predicate returns false.
func Drop ¶
func Drop[T any](l *LinkedList[T], n int) *LinkedList[T]
func Filter ¶
func Filter[T any](l *LinkedList[T], p func(T) bool) *LinkedList[T]
Evaluates elements of given list and filters out those elements which fail predicate, preserving order of original list.
func Push ¶
func Push[T any](h T, l *LinkedList[T]) *LinkedList[T]
func Tail ¶
func Tail[T any](l *LinkedList[T]) (*LinkedList[T], error)
func ToList ¶
func ToList[T any](xs []T) *LinkedList[T]
func Zero ¶
func Zero[T any]() *LinkedList[T]
func (*LinkedList[T]) String ¶
func (w *LinkedList[T]) String() string
Click to show internal directories.
Click to hide internal directories.