2

I assume my question has been answered before, but I can't find such an answer anywhere:.

How can I drop the first element from each sublist within a list? I should be able to use

Map[Drop, list,2]

right? But how could I give Drop the arguments it needs from within Map?

m_goldberg
  • 107,779
  • 16
  • 103
  • 257
Nate
  • 103
  • 5

1 Answers1

2

Prepare some data

data=Permutations[Range[3]]
(*{{1, 2, 3}, {1, 3, 2}, {2, 1, 3}, {2, 3, 1}, {3, 1, 2}, {3, 2, 1}}*)

Drop first element of each list

Map[Drop[#, 1] &, data]
(*{{2, 3}, {3, 2}, {1, 3}, {3, 1}, {1, 2}, {2, 1}}*)

Of course Rest as suggested by @Karsten is even shorter.

yarchik
  • 18,202
  • 2
  • 28
  • 66