[Question]
  [
In this challenge you will take as input a non-empty list of binary values (these can be booleans or integers on the range 0-1), you should output all the ways to partition the list into non-empty sections such that no two adjacent equal values in the initial list are separated into different sections.
For example if the input is `[1,1,0,0,1]` then `[1,1],[0,0,1]` is a valid partition but `[1,1,0],[0,1]` is not since the adjacent `0`s are divided.
This is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'") so the goal is to minimize the size of your source code as measured in bytes.
## Test cases
```
[1,0] ->
  [ [[1,0]]
  , [[1],[0]]
  ]
[1,1,1,1] ->
  [ [[1,1,1,1]]
  ]
[1,1,0,0,1] ->
  [ [[1,1,0,0,1]]
  , [[1,1],[0,0,1]]
  , [[1,1,0,0],[1]]
  , [[1,1],[0,0],[1]]
  ]
```
  
[Answer]
# [K (ngn/k)](https://codeberg.org/ngn/k), 22 bytes
```
{(&'+1,!2-1_=':x)_\:x}
```
[Try it online!](https://ngn.codeberg.page/k#eJxLs6rWUFPXNtRRNNI1jLdVt6rQjI+xqqjl4uJKczBUMACTYAhlGQChIQBVpwuO)
`1_=':x` For pairs of adjacent values: are they equal?  
`2-` 2 minus that. Gives 2s for the lines between sections and 1s in sections.  
`!` odometer. Returns a matrix with all binary patterns bounded by the vector.  
`+1,` prepend a 1 and transpose to have the binary patterns with leading 1s in the rows.  
`&'` Get indices of 1s for each row.  
`(...)_\:x` For each of those integer vectors, split the input at those indices.
[Answer]
# [Factor](https://factorcode.org) + `math.combinatorics math.unicode`, 81 bytes
```
[ dup 2 clump [ Σ 1 = ] arg-where 1 v+n all-subsets [ split-indices ] with map ]
```
[Attempt This Online!](https://ato.pxeger.com/run?1=PU4xTsQwEOzvFdOjWAcVAiHRIRokhKiiFD5nL1mR2MZe34EQD0E0kRC8gHfQ329wznDaYnZ2dmfn_Wutjbgw7d7u765vrs7wQMHSgC645Nl2GLX0Klk2riVEekxkDUVFTxJ0LOqGZos_Yty4YqvzgE1E9AOLzD6HU_hAIs8-sBWcLxYvOMYSr3ss9d8vc2X2mWRdne5ua7TJ4wRmSKNHjZ-PrF6ggQ5dte0pUOabIws9DFVMq0gS89o-QsW25fl5gy1Ln6N6NMX4u4ZSKgs5uXeRIIEvizRNBX8B)
* `dup 2 clump [ Σ 1 = ] arg-where 1 v+n` get the indices of rising and falling edges
* `all-subsets` take all the subsets of that
* `[ split-indices ] with map` split the input according to each of these
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 8 [bytes](https://github.com/DennisMitchell/jelly/wiki/Code-page)
```
ITŒP‘œṖ€
```
A monadic Link that accepts a list of ones and zeros and yields a list of the valid partitions.
**[Try it online!](https://tio.run/##y0rNyan8/98z5OikgEcNM45Ofrhz2qOmNf8Ptx@d9HDnDCAz8v//aEMdQx0DIDREggaxAA "Jelly – Try It Online")**
### How?
```
ITŒP‘œṖ€ - Link: list, B  e.g. [0, 0, 1, 1, 0, 1]
I        - deltas (of B)       [  0, 1, 0,-1, 1]
 T       - truthy indices      [     2,    4, 5]
  ŒP     - powerset            [[],[2],[4],[5],[2,4],[2,5],[4,5],[2,4,5]]
    ‘    - increment           [[],[3],[5],[6],[3,5],[3,6],[5,6],[3,5,6]]
       € - for each:
     œṖ  -   partition (B) at  [[[0,0,1,1,0,1]],[[0,0],[1,1,0,1]],[[0,0,1,1],[0,1]],[[0,0,1,1,0],[1]],[[0,0],[1,1],[0,1]],[[0,0],[1,1,0],[1]],[[0,0,1,1],[0],[1]],[[0,0],[1,1],[0],[1]]]
```
[Answer]
# [Curry (PAKCS)](https://www.informatik.uni-kiel.de/%7Epakcs/), 40 bytes
```
f(a++b:c:d)|b/=c=(a++[b]):f(c:d)
f a=[a]
```
[Try it online!](https://tio.run/##Sy4tKqrULUjMTi7@/z9NI1FbO8kq2SpFsyZJ3zbZFsSPTorVtErTAAlypSkk2kYnxv7PTczMU7BVSFOINtQx1DEAQsPY/wA "Curry (PAKCS) – Try It Online")
[Answer]
# [Vyxal](https://github.com/Vyxal/Vyxal), 6 bytes
```
ĠøṖvvf
```
[Try it Online!](https://vyxal.pythonanywhere.com/#WyJQQSIsIiIsIsSgw7jhuZZ2dmYiLCIiLCJbMSwwXVxuWzEsMSwxLDFdXG5bMSwxLDAsMCwxXSJd)
Port of @UnrelatedString's Brachylog answer.
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E/wiki/Commands), 6 (or 4?) [bytes](https://github.com/Adriandmen/05AB1E/wiki/Codepage)
```
γ.œ€€˜
```
[Try it online](https://tio.run/##yy9OTMpM/f//3Ga9o5MfNa0BotNz/v@PNtQx1DEAQsNYAA) or [verify all test cases](https://tio.run/##yy9OTMpM/V9Waa@k8KhtkoKSfeX/c5v1jk5@1LQGiE7P@a/zPzraUMcgVgdIgiGUZQCEhrGxAA).
If we can use strings as I/O, this could be 4 [bytes](https://github.com/Adriandmen/05AB1E/wiki/Codepage) instead by replacing `€€˜` with `J`:  
[Try it online](https://tio.run/##yy9OTMpM/f//3Ga9o5O9/v83NDQwMAQA) or [verify all test cases](https://tio.run/##yy9OTMpM/V9Waa@k8KhtkoKSfeX/c5v1jk72@q/zP9rQQMcQCICEgYFhLAA).
**Explanation:**
```
γ       # Split the (implicit) input-list into groups of equal adjacent values
 .œ     # Get all partitions of these groups
   €    # For each partition:
    €   #  For each part of groups within a partition:
     ˜  #   Flatten the part of groups to a single list
        # (or alternatively:)
   J    # Join each list/part of groups within each partition together
        # (after which the result is output implicitly)
```
[Answer]
# [Brachylog](https://github.com/JCumin/Brachylog), 5 bytes
```
ḅ~ccᵐ
```
[Try it online!](https://tio.run/##SypKTM6ozMlPN/pfXa6koGunoFRu/6htw6OmpofbFjzc1Vn7cOuE/w93tNYlJ4NY/6OjDXUMYnWAJBhCWQZAaBgbCwA "Brachylog – Try It Online")
Takes a list through the input variable and [generates](https://codegolf.meta.stackexchange.com/questions/2447/default-for-code-golf-input-output-methods/10753#10753) a list of lists of lists through the output variable.
```
ḅ        Partition into runs of consecutive equal elements.
 ~c      Take an arbitrary partition of the list of runs,
   cᵐ    and concatenate each slice.
```
[Answer]
# [Brachylog](https://github.com/JCumin/Brachylog), 20 bytes
```
Ė!|ḅa₀cPl;?b₍↰;Pgᵗ↔c
```
A predicate that takes a list of 0's and 1's as input and outputs each possible partition [one after another](https://codegolf.meta.stackexchange.com/a/9134/16766).
[Try it online!](https://tio.run/##SypKTM6ozMlPN/r/qG3Do6bGh7s6H3Ut/X9kmmLNwx2tiY@aGpIDcqztkx419QIVWAekP9w6/VHblOT//6MNdQx1DIDQMBYA "Brachylog – Try It Online")
### Explanation
This seems way too long.
```
Ė!|ḅa₀cPl;?b₍↰;Pgᵗ↔c
Ė!                    Either the input is an empty list (in which case return empty list)
  |                   Or, take the input and...
   ḅ                  Partition into blocks of equal elements
    a₀                Get a prefix of that list of blocks
      c               Flatten it
       P              Call that list P
        l             Take its length
         ;?b₍         The original input with that many elements removed from the front
             ↰        Recurse (returns a list of lists)
              ;P      Pair with P
                gᵗ    wrapped in a list
                  ↔   Reverse the order of the pair
                   c  Flatten once
```
[Answer]
# [Prolog (SWI)](http://www.swi-prolog.org), 65 bytes
```
Q+[E|F]:-append(A,[B,C|D],Q),B\=C,append(A,[B],E),[C|D]+F.
Q+[Q].
```
[Try it online!](https://tio.run/##KyjKz8lP1y0uz/z/P1A72rXGLdZKN7GgIDUvRcNRJ9pJx7nGJVYnUFPHKcbWWQdJIlbHVVMnGiSr7abHBdQaGKv330pXIS2/KDEnRyPaUMdQxwAIDWO1g3QUyosyS1Jz8jSCNDX1/gMA "Prolog (SWI) – Try It Online")
Similar to @alephalpha's Curry answer. Outputs as a list of choicepoints.
[Answer]
# [J](http://jsoftware.com/), 27 bytes
```
<;.1~1,.[:(#:[:i.*/)2-2=/\]
```
[Try it online!](https://tio.run/##y/pvqWhlGGumaGWprs6lpKeepmBrpaCuoKNgoGAFxLp6Cs5BPm7/baz1DOsMdfSirTSUraKtMvW09DWNdI1s9WNi/2tycaUmZ@QrpCkYKhggmGAI5@oY6hgAoeF/AA "J – Try It Online")
*-1 bytes thanks to the "2 minus" trick stolen from ovs's answer*
Say we have, eg, `1,1,0,0,1` -- then we have 2 "change points" and 4 possible combos. This is *essentially* just the problem of listing:
```
0 0 
0 1
1 0
1 1
```
except we want that that list to be embedded in the `X`s of this list:
```
0 X 0 X
```
The key insight is that this is 0..3 converted using the *mixed base* number `1 2 1 2`. After that we just cut the original input using our 4 lists, with a 1 prepended to each.
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 7 bytes
```
Ir0Œpk€
```
[Try it online!](https://tio.run/##y0rNyan8/9@zyODopILsR01r/h9uPzrp4c4ZQObDnYsi//@PNtQx1DEAQkMkaBALAA "Jelly – Try It Online")
Inspired by [Jonathan Allan's solution](https://codegolf.stackexchange.com/a/252314/85334).
```
I          Get the forward differences of the list.
     k     Partition the list after each truthy position
      €    of each element of
   Œp      the Cartesian product of
 r0        the ranges from each difference to 0 inclusive.
```
# [Jelly](https://github.com/DennisMitchell/jelly), 7 bytes
```
ŒgŒṖẎ€€
```
[Try it online!](https://tio.run/##y0rNyan8///opPSjkx7unPZwV9@jpjVA9P9wO0hgBpD5cOeiyP//DXUMdQyA0BAJGgAA "Jelly – Try It Online")
Port of my Brachylog solution.
```
Œg         Partition into runs of consecutive equal elements.
  ŒṖ       Generate every partition of the runs,
    Ẏ€€    and concatenate the runs in each slice.
```
[Answer]
# [Retina 0.8.2](https://github.com/m-ender/retina/wiki/The-Language/a950ad7d925ec9316e3e2fb2cf5d49fd15d23e3d), 28 bytes
```
(.),(?!\1)
$1#
+%1`#
;$'¶$`,
```
[Try it online!](https://tio.run/##K0otycxL/H9oG9ehbYe2/dfQ09TRsFeMMdTkUjFU5tJWNUxQ5rJWUT@0TSVB5/9/Qx0DLkMdMATTBkBoCAA "Retina 0.8.2 – Try It Online") Link includes test cases. Outputs semicolon-delimited lists. Explanation:
```
(.),(?!\1)
$1#
```
Find all acceptable cutting points.
```
+
```
Loop until each cutting point has been processed.
```
%
```
Loop over each partially cut list.
```
1`
```
Only process the first remaining cutting point on each pass.
```
#
;$'¶$`,
```
Create two lists, one cut at that point, one not cut at that point.
[Answer]
# [Perl 5](https://www.perl.org/), 80 bytes
```
sub{@p=pop=~/0+|1+/g;$s="@p";map$s=~s, ,$r=$_%2?$&:'';$_/=2;$r,ger,0..2**@p/2-1}
```
[Try it online!](https://tio.run/##VY9RT8IwFIWf3a84aQpjUFiZ4YWmshefTXhVQjTZyFS22s5Eg/DX5@02QPvQfPeec09vTWbfF83@GzzXjft8OaRGm8roUywnP/NJvFPcaZYapvbPhvDkBAS3mm8HyYoPl2Go@DbWieJW7DIr5GyWjMepiZPp/NioIK8sfHqduRqjAMAjEM5lSAR916KgG9TZiItOJ@z1Dv35q0tJ3U736CMo40xS4tojxCaIDn6YdhnxojQizb5MpNN2L9UrSHdVDY0hz1tTdBE4uV1t9WtVlD63Hb@qNPZfpUanGluUdQ42mC4cKHKJlgCa93wrfUF2KtxTyURw07@F7OMcjBVY9cawBLtfrx/Wrct/4mL21HlVcGx@AQ "Perl 5 – Try It Online")
[Answer]
# [Knight](https://github.com/knight-lang/knight-lang) (v2), 125 bytes
```
;=lL=p+=a@P;W=l-lT|?Gp lT Gp-lT1=a+a,l;=n^2LaW+1=n-nT;=x!=b+=o@p;=kLa;W+=k-kT1&%/n^2k 2;=o+o,GbF=d+~x=x[Ga kT=bSbFd@;D+o,bO''
```
[Try it online!](https://knight-lang.netlify.app/v2#WyI7PWxMPXArPWFAUDtXPWwtbFR8P0dwIGxUIEdwLWxUMT1hK2EsbDs9bl4yTGFXKzE9bi1uVDs9eCE9Yis9b0BwOz1rTGE7Vys9ay1rVDEmJS9uXjJrIDI7PW8rbyxHYkY9ZCt+eD14W0dhIGtUPWJTYkZkQDtEK28sYk8nJyIsIjExMDAxIl0=)
Input as a binary string. Outputs each partition on a separate line.
This probably is not even the golfiest strategy lol, but whatever. The general strategy is to construct a list `a` that contains the possible indexes that can be cut at (the easy part), then enumerate over all possible combinations of cuts using `a` (the annoying as f\*\*\* part).
[Answer]
# [Haskell](https://www.haskell.org/), 94 bytes
```
import Data.List
f l=nub[w|w<-subsequences[id=<<x|x<-tails=<<(inits.group)l,x>[]],(w>>=id)==l]
```
[Try it online!](https://tio.run/##jYqxDoIwFEV3vuKFOEACBPeWyZHNselQpOiLpUD7Ghj490p0cjHmDDcn9zyUf2pjYsRxnhzBRZGqWvSUDGC4DZ1Y95WVPnReL0Hbm/YCe87Ytm@sJIXGH5KhRfLV3U1hzk2xNULKIlubhmOfc25kHBVa4NBPCcwOLcEJBnEuanl4oCu51kKafp9vfgf1wT/JZ2V8AQ "Haskell – Try It Online")
Corrected as x specifications.
Thanks to @Wheat Wizard for saving some bytes using *id=<<x* instead of concat.
[Answer]
# [Charcoal](https://github.com/somebody1234/Charcoal), 45 bytes
```
⊞υ⟦Ａ⟧ＦυＦ…ι¹Ｆ²Ｆ⁺¹⌕Ａ⪫κω⁺Ｉλ¬λ⊞υ⁺⟦…κμ✂κμ⟧ΦιξＥυ⭆¹ι
```
[Try it online!](https://tio.run/##RU7LCsIwELz3K3LcQATjtScpCApKoceQQ4jVBtekpImPr49Jrbh7GGZ3Z2b1oLx2ClNq4zRAZETs7RgDUEnr6uI8gUjJjM1bY98MbgTDCKfLdLNgi3ECzsjO2PMWEQ7OWLgx8qSMzLtGTQEws5MrWIr8MucD8Q/Iunu@7NDo/ktkccbQ@xL@ytq6ar2xAY5qLA5dyOxaSP7BlH1KQnDG2To3lzKtHvgB "Charcoal – Try It Online") Link is to verbose version of code. Explanation:
```
⊞υ⟦Ａ⟧
```
Start with the original list, which is always a valid partition.
```
Ｆυ
```
Loop over the partitions found so far.
```
Ｆ…ι¹
```
Loop over the lists in the current partition, but stop after the first. (This is a sneaky way of getting the first list into a variable.)
```
Ｆ²
```
Loop over the possible first bits of a cutting point.
```
Ｆ⁺¹⌕Ａ⪫κω⁺Ｉλ¬λ
```
Loop over all of the possible cutting points that start with that bit. The cutting point is in between the bits, thus the extra `1` added to the positions. (`Incremented` works on empty lists in the newer version of Charcoal on ATO which would save a byte.)
```
⊞υ⁺⟦…κμ✂κμ⟧Φιξ
```
Cut the first list of the partition at that point and push the resulting partition to the list of partitions where it will be reevaluated for cutting.
```
Ｅυ⭆¹ι
```
Pretty-print all of the found partitions.
[Answer]
# [Pyth](https://github.com/isaacg1/pyth), 11 10 bytes
```
mmrk9d./r8
```
[Try it online!](https://tio.run/##K6gsyfj/Pze3KNsyRU@/yOL/f3VDQwMDQ3UA "Pyth – Try It Online")
### Explanation
```
        r8    length encode the implicitly evaluated input
      ./      get all partitions
mmrk9d        map length decoding to each partition element
```
[Answer]
# [Python](https://www.python.org), 230 bytes
```
from itertools import*
import re
def f(M):L=re.split(r'((.)\2*)',''.join(map(str,M)))[1::3];l=len(L);I=[*range(1,l)];return[[M]]+[[[int(c)for c in''.join(L[i:j])]for i,j in pairwise([0,*P,l])]for s in I for P in combinations(I,s)]
```
[Attempt This Online!](https://ato.pxeger.com/run?1=NZBBTsQwDEX3c4rsapdQTWGDWvUAlVpp9iGLUlJwlSaRkxHiLGxmA6fgIlyAc9BqqLzwl5_lb_vjK7ynV-8ul89zmm4ffn4n9ougZDh5b6OgJXhO-eGaBZvDs5nEBD1WXcOmiMFSAs4ACny8yzGTWVbMnhwsQ4CYWPaIqMqqute1baxx0GHdNirnwb0YKKVFXbNJZ3ZK9VrfKKXIJRhx8ixGQW4f2CmqZo16q5OcVyLCQPxG0YA6yvwk7T-NG2vFJk-bHP3yRG5I5F2EVkbU12u_Vb5tGXg1lBOoUpbyuEapcW_ZH_MH)
Python 3.10+ required for `pairwise`.
for `[1,1,0,0,1]` returns:
```
[[[1, 1, 0, 0, 1]],
 [[1, 1], [0, 0, 1]],
 [[1, 1, 0, 0], [1]],
 [[1, 1], [0, 0], [1]]]
```
ungolfed:
```
from itertools import *
import re
def f(M):
  # produce ['11', '00', '1'] by splitting on regex which checks 2 consecutive duplicates
  L = re.split(r'((.)\2*)',''.join(map(str,M)))[1::3]
  l = len(L)
  indexes = [*range(1,l)]
  return [[M]]+[
    # wrap list for each consequtive pair of index combos and convert back from string
    [[int(c) for c in ''.join(L[i:j])]
      for i,j in pairwise([0,*partition_indexes,l])]
    for partition_size in indexes
    for partition_indexes in combinations(indexes,partition_size)
  ]
```
[Answer]
# [Nekomata](https://github.com/AlephAlpha/Nekomata), 4 bytes
```
ĉJᵐj
```
[Attempt This Online!](https://ato.pxeger.com/run?1=m70iLzU7PzexJHFZtJJurlLsgqWlJWm6FsuPdHo93Doha0lxUnIxVGzB7mhDHYNYLiAJhlCWARAaxkKUAAA)
A port of [@Unrelated String's Brachylog answer](https://codegolf.stackexchange.com/a/252326/9288).
```
ĉ       Partition into runs of consecutive equal elements.
 J      Take an arbitrary partition of the list of runs,
  ᵐj    and concatenate each slice.
```
[Answer]
# [JavaScript (V8)](https://v8.dev/), 71 bytes
```
f=([x,...y],z='')=>x?f(y,z+x)|f(y,[z,x]):/^,|1,1|0,0/.test(z)||print(z)
```
[Try it online!](https://tio.run/##FcZBCoAgEADAex/RpU3dWxTWQ6IgIqEOESVisn83nNOca1jf7Tlu34Q2Z2flFFEp9c2YrBBghzg6@WGqI3DJlDDO0OkFmZDYoNHK76@XCZjv57jKcl85KYiMIQH5Bw "JavaScript (V8) – Try It Online")
Seems they look same
# [JavaScript (V8)](https://v8.dev/), 72 bytes
```
f=([x,...y],z='')=>x?f(y,z+x)|f(y,z+[,x]):/^,|1,1|0,0/.test(z)||print(z)
```
[Try it online!](https://tio.run/##JcZBCoAgEADAex/Rpc3cWxTWQ6JAIsEOESVhsn83ojnNZm97Lac/QnU3OTsjx4hKqWfCZIQA08fByQdTGYH/jBgnaOsZmZBYo65VWK8gEzAfp9@/5a5wUhBpTQLyCw "JavaScript (V8) – Try It Online")
]