package tablecloth-native
Legend:
Library
Module
Module type
Parameter
Class
Class type
Library
Module
Module type
Parameter
Class
Class type
Provides a sliding 'window' of sub-lists over a list.
The first sub-list starts at the head of the list and takes the first size
elements.
The sub-list then advances step
(which defaults to 1) positions before taking the next size
elements.
The sub-lists are guaranteed to always be of length size
and iteration stops once a sub-list would extend beyond the end of the list.
List.sliding [1;2;3;4;5] ~size:1 = [[1]; [2]; [3]; [4]; [5]]
List.sliding [1;2;3;4;5] ~size:2 = [[1;2]; [2;3]; [3;4]; [4;5]]
List.sliding [1;2;3;4;5] ~size:3 = [[1;2;3]; [2;3;4]; [3;4;5]]
List.sliding [1;2;3;4;5] ~size:2 ~step:2 = [[1;2]; [3;4]]
List.sliding [1;2;3;4;5] ~size:1 ~step:3 = [[1]; [4]]
List.sliding [1;2;3;4;5] ~size:2 ~step:3 = [[1; 2]; [4; 5]]
List.sliding [1;2;3;4;5] ~size:7 = []
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>