package tablecloth-native
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Module Tablecloth.ListSource
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 = []List.repeat ~count=n v returns a list with the value v repeated n times.
List.repeat ~count:3 99 = [99; 99; 99]
List.repeat ~count:0 99 = []