# How can I get an element of a sequence?

How can I get an element of a sequence?
For example Sequence[a,b,c,d]
How can get c?

• Wrap it in a list and then take parts of that list? Feb 4 at 0:36
• @J.M. yes, I did that before but was wondering if that is how people normally do it. Feb 4 at 0:47
• Part is more natural. But you can also use Slot: i.e., #3 &@Sequence[a, b, c, d].
– kglr
Feb 4 at 1:05
• With Part are you talking about the method that J. M. mentioned above? @kglr Feb 5 at 10:14
• that's right...
– kglr
Feb 5 at 12:34

seq = Sequence[a, b, c, d]

Sequence[a, b, c, d]


You can use a composition of Part ([[...]]) and List as suggested by J.M.'sennui:

{seq}[[3]]

c

(Part[#, 3] & @* List)[seq]

c


Alternatively, you can use Slot[3] (that is, #3):

#3 & @ seq

c

Slot[3] &[seq]

c

• Is there any advantage of writing (Part[#, 3] & @* List)[seq] instead of {seq}[[3]]? Feb 8 at 7:37
• @anhnha, can't think of any.
– kglr
Feb 8 at 8:13