0
$\begingroup$

This question already has an answer here:

How do I do generate all possibilities to "partition"/ "split"/ "group" a list?

In:partitions[{1,1,2,3}]

Out:{
  {{1,1,2,3}},
  {{1},{1,2,3}},
  {{1},{1},{2,3}},
  {{1},{1},{2},{3}},
  {{1,1},{2,3}},
  {{1,1},{2},{3}},
  {{1,1,2},{3}},
  {{1},{1,2},{3}}
}

that is how do I get all possible "cuttings" of a list? In my case duplicates are relevant, so the list from In needs to be considered a list and has also order (only adjacent elements can become members of the same part of a partition). The order of the lists returned does not matter.

I think I must be missing something because there are Partition, Split and Grouping and none of them seems to do just cutting up a list in all possible ways.

thx in advance

$\endgroup$

marked as duplicate by J. M. is away Apr 22 '17 at 19:00

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1
$\begingroup$
 ReplaceList[{1, 1, 2, 3}, {x___, y___, z___, w___} :> {{x}, {y}, {z}, {w}}] 
/. {} :> Sequence[] // DeleteDuplicates


(* {{{1, 1, 2, 3}}, {{1}, {1, 2, 3}}, {{1, 1}, {2, 3}}, {{1, 1, 2}, {3}},
{{1}, {1}, {2, 3}}, {{1}, {1, 2}, {3}}, {{1,1}, {2}, {3}}, {{1}, {1}, {2}, {3}}} *)
$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.