I have a list of lists
proof = List[{-1, 2, 3, -1}, {-1, 2, 4, -1}, {-1, 7, 9, -1}, {-1, 7, 2, -1},
{-1, 3, 9, -1}, {-1, 7, 9, -1}, {-1, 5, 9, -1}];
I would like to obtain the same list discarding the first and last entry of each sublist (those marked with -1.
Rest[Most[proof[[1]]]]
works for one of the lists, but when I tried
Rest[Most[proof[[All]]]]
it doesn't work and the output is the same as
Rest[Most[proof]]
(it discards the two external sublists).
I could use
proof = Rest[Reap[Do[Sow[Rest[Most[proof[[k]] ]]], {k,1,7}]]]
Rest is used to discard a NULL result and this returns a triple nested list. Is there an easier/elegant way of doing this?
Rest[Most[#]& /@ proof
or equivalentlyMap[Rest[Most[#]&,proof]
$\endgroup$Drop[proof, None, {1, -1, 3}]
$\endgroup$proof.SparseArray[Band[{2, 1}] -> 1, {4, 2}]
. See here $\endgroup$