2 added 129 characters in body
source | link

How can I partition a list into partitions whose sizes vary? The length of the $k$'th partition is a function $f(k)$.

For example: if $l = \{1, 2, 3, 4, 5, 6\}$ and $f(k) = k$. Then the partitioning $p$ would look like $p = \{\{1\},\{2, 3\},\{4,5,6\}\}$


In Mathematica 11.2, the builtin TakeList will do this.

How can I partition a list into partitions whose sizes vary? The length of the $k$'th partition is a function $f(k)$.

For example: if $l = \{1, 2, 3, 4, 5, 6\}$ and $f(k) = k$. Then the partitioning $p$ would look like $p = \{\{1\},\{2, 3\},\{4,5,6\}\}$

How can I partition a list into partitions whose sizes vary? The length of the $k$'th partition is a function $f(k)$.

For example: if $l = \{1, 2, 3, 4, 5, 6\}$ and $f(k) = k$. Then the partitioning $p$ would look like $p = \{\{1\},\{2, 3\},\{4,5,6\}\}$


In Mathematica 11.2, the builtin TakeList will do this.

    Tweeted twitter.com/#!/StackMma/status/217974742496456704
1
source | link

Partitioning with varying partition size

How can I partition a list into partitions whose sizes vary? The length of the $k$'th partition is a function $f(k)$.

For example: if $l = \{1, 2, 3, 4, 5, 6\}$ and $f(k) = k$. Then the partitioning $p$ would look like $p = \{\{1\},\{2, 3\},\{4,5,6\}\}$