darklang / tablecloth

A standard library with the same API in F#, Rescript and OCaml

Home Page:https://www.tablecloth.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

List.chunksOf drops remaining elements

pbiggar opened this issue · comments

The current docs for List.chunksOf say that "If there aren't enough elements to make the last 'chunk', those elements are ignored."

This is a bad thing, and led me to have issues in production.

Also look into List.sliding

Similar functions in Ramda and Lodash do not guarantee that the final chunk will have the same length as the other elements. I guess this should be the default behavior for the Tablecloth as well, and the current behavior should be renamed to chunksOfStrict or something like that.