I often get Lists that contain a single item, like {name} or {{2,3,4}}.

Is there a function that simply takes the item out of the List without needing to use Part, like #[[1]]&?

  • $\begingroup$ Uh, isn't #[[1]]& a crude version of Part? The double bracket [[]] is a short version of Part, check a[[1]] // FullForm. $\endgroup$ – Grzegorz Rut May 11 '14 at 17:08
  • 1
    $\begingroup$ First ... Last... $\endgroup$ – Yves Klett May 11 '14 at 17:08
  • $\begingroup$ I intend to close this as a duplicate of (20180) unless you explain why it not the same. $\endgroup$ – Mr.Wizard May 11 '14 at 17:13
  • $\begingroup$ What's wrong with Part? It's a basic and very fast function. $\endgroup$ – m_goldberg May 11 '14 at 17:24

You can use First as in First@{{2,3,4}}. Not entirely sure though, why this should be preferable to [[1]].


Not the answer you're looking for? Browse other questions tagged or ask your own question.