{{1, 2}, {2, 3}, {5, 4}}
I tried to do this:
Drop[#, {2}] & @@ {{1, 2}, {2, 3}, {5, 4}}
but it gave
{1}
but what I want is
{{1},{2},{5}}
{{1, 2}, {2, 3}, {5, 4}}
I tried to do this:
Drop[#, {2}] & @@ {{1, 2}, {2, 3}, {5, 4}}
but it gave
{1}
but what I want is
{{1},{2},{5}}
Your result is the first column of a matrix. If list={{1, 2}, {2, 3}, {5, 4}} ,
res=list[[All, 1]]
If you need the brackets around each element, Partition[res, 1]
If your lists are of unequal length, the solution from Lukas Lang is fine. I include for completeness.
Drop[#, {2}] & /@ {{1, 2}, {2, 3}, {5, 4}}
Map(/@) instead ofApply(@@).Drop[#, {2}] & @@ {{1, 2}, {2, 3}, {5, 4}}is essentially equivalent toDrop[{1, 2}, {2, 3}, {5, 4}, {2}], which is clearly not what you want – Lukas Lang Jan 08 '19 at 12:19Delete, notDrop.Dropis the opposite ofTake. – Sjoerd Smit Jan 08 '19 at 14:06Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign!
– Chris K Jan 08 '19 at 14:40