Is there a `List` method in stdlib which converts ...
# announcements
e
Is there a
List
method in stdlib which converts
[1, 2, 3, 4]
into
[[1, 2], [2, 3], [3, 4]]
?
m
list.windowed(2)
e
Thanks
g
.zipWithNext()
m
Or that one.
zipWithNext
returns a list of pairs though.
👍 1
e
Oh, then
zipWithNext
is better in my use case
Thanks guys
👍 1
d
Incredible that the stdlib has that tbh
d
You can also provide a transform function to zipWithNext, making it even more snazzy
d
@edwardwongtl Out of curiosity, what kind of functionality do you need to do that for?