Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Intersperse is missing in cats?

I only found several methods which were all unaccessible - intersperseList.

Why isn't it accessible? Or is there somewhere a function which does the intersperse operation?

Example of functionality from ScalaZ:

scala> intersperse(List(1, 2, 3), 7)
res3: List[Int] = List(1, 7, 2, 7, 3)
like image 320
monnef Avatar asked Mar 14 '17 12:03

monnef


1 Answers

Intercalate is the closest thing in cats I think: https://github.com/typelevel/cats/blob/882a67387f3c538237b0afbf9f0389ad5f34a648/core/src/main/scala/cats/Foldable.scala#L469-L498

like image 112
Haspemulator Avatar answered Nov 03 '22 20:11

Haspemulator