Given a list like
list={{1},{2,3},{3,4,6},{6,7,8,5}};
I would like to very efficiently delete all sublists that are longer than a specific length, i.e.:
delLongSublists[list,2]
{{1},{2,3}}
My attempt at writing this function is:
delLongSublists[in_,q_]:=DeleteCases[in, Length[_List] > q, 1]
Unfortunately this does not work at all
delLongSublists[list, 2]
{{1},{2,3},{3,4,6},{6,7,8,5}}
Any suggestion on how to write this function computationally efficiently?


DeleteCases[list, x_ /; Length[x] > q]– Nasser Aug 09 '16 at 09:42