FoldableNFunctions
cats.FoldableNFunctions
Attributes
- Source
- FoldableNFunctions.scala
- Graph
-
- Supertypes
- Known subtypes
- Self type
-
Foldable[F]
Members list
Grouped members
foldable arity
Group sequential elements into fixed sized tuples by passing a "sliding window" over them. A foldable with fewer elements than the window size will return an empty list unlike Iterable#sliding(size: Int)
. Example:
import cats.Foldable
scala> Foldable[List].sliding2((1 to 10).toList)
val res0: List[(Int, Int)] = List((1,2), (2,3), (3,4), (4,5), (5,6), (6,7), (7,8), (8,9), (9,10))
scala> Foldable[List].sliding4((1 to 10).toList)
val res1: List[(Int, Int, Int, Int)] = List((1,2,3,4), (2,3,4,5), (3,4,5,6), (4,5,6,7), (5,6,7,8), (6,7,8,9), (7,8,9,10))
scala> Foldable[List].sliding4((1 to 2).toList)
val res2: List[(Int, Int, Int, Int)] = List()
Attributes
- Source
- FoldableNFunctions.scala
Attributes
- Source
- FoldableNFunctions.scala
Attributes
- Source
- FoldableNFunctions.scala
Attributes
- Source
- FoldableNFunctions.scala
Attributes
- Source
- FoldableNFunctions.scala
Attributes
- Source
- FoldableNFunctions.scala
Attributes
- Source
- FoldableNFunctions.scala
Attributes
- Source
- FoldableNFunctions.scala
Attributes
- Source
- FoldableNFunctions.scala
Attributes
- Source
- FoldableNFunctions.scala
Attributes
- Source
- FoldableNFunctions.scala
Attributes
- Source
- FoldableNFunctions.scala
Attributes
- Source
- FoldableNFunctions.scala
Attributes
- Source
- FoldableNFunctions.scala
In this article