J, 18 bytes
,"1/^:(]{:)~@,.@i.
Iterative solution, no built-in cartesian product. This is what peak J looks like.
input 2
i. range 0, 1
,.@ reshape each element
into a one-dimensional array [0],[1] (A)
^:(]{:) (input−1) times... (1 iteration)
,"1/ ~@ prepend each 1d array in A |
to every 1d array from the previous iteration,|
assembling the results for each A[n] into |!CANTEXPLAINTHIS!
a larger array |
[ [0,0], |
[0,1] ], |
[ [1,0], |
[1,1] ], |