Same length sub arrays

Python 2, 31

lambda l:l and l==zip(*zip(*l))

This requires the lists to be lists of tuples. zip Drops extra elements if the input was ragged, so double zipping is only a noop if the lists all have the same length.

Try it here


Pyth - 7 5 bytes

Saved 2 bytes thanks to @FryAmTheEggman.

And I was the one who told @issacg to remove the q default...

?QqCC

Test Suite.


Javascript ES6, 44 43 42 bytes

Saved 1 byte thanks to @Neil

a=>a[0]?!a.some(b=>b.length-a[0].length):a

Alternative solutions

a=>a[0]?a.every(b=>b.length==a[0].length):a // 43
a=>a[0]?new Set(a.map(b=>b.length)).size==1:a // 45
a=>a[0]?Math.max(...a.map(b=>b.length))==a[0].length:a // 54
a=>a[0]?[a[0].length,...a].reduce((b,d)=>b==d.length):a // 55, doesn't work as intended

Somehow the stacksnippet doesn't print [], try it in your console for the actual result.

f=
a=>a[0]?a.every(b=>b.length==a[0].length):a

z.innerHTML = [
  [],
  [[1], [1], [2]],
  [[1]],
  [[1, 2, 3, 4]],
  [[1, 2, 3, 4, 5], [2], [12, 314123]],
  [[1, 2, 3, 4], [1]]
].map(m=>JSON.stringify(f(m))).join`<br>`
<pre id=z>

(yay for crossed out 44)