add SliceToSeq2 by yangjinheng · Pull Request #776 · samber/lo

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would rename it Pairwise.

See the samber/ro implem: https://ro.samber.dev/docs/operator/combining#pairwise

Please write 2 implementations:

  • core package -> returns [][]T or []T2[T, T]
  • it/ package -> returns iter.Seq[[]T] or iter.Seq[T2[T, T]]

Using iter.Seq2 does not seem a good idea here, since first argument of Seq2 is expected to be a key.

I would use T2 tuples instead of simple slices []T.