# How to append to a list of lists elegantly [duplicate]

This question already has an answer here:

I have have list of lists and I would like to be able to append an element to the start of each list. I am sure there must be an elegant solution.

EG: a and {{b,c},{d,e,f}} -> {{a,b,c},{a,d,e,f}}

If I want to apply a function to a list of lists I normally use @@@ however I don't know how to modify this so that it gets feed into the second argument or AppendTo.

Can someone please explain how I could achieve this?

## marked as duplicate by Mr.Wizard♦Sep 11 '14 at 10:13

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

• Prepend[#, a] & /@ {{b, c}, {d, e, f}}? I feel there is a thread on this around already, probably with a thousand nice solutions... – Yves Klett Sep 11 '14 at 9:45
• Yep, thanks. I am bad with # and &. Cheers! – User Sep 11 '14 at 9:47
• This is closely related Interlacing a single number into a long list, however I'm sure there are exact duplicates of this question. – Artes Sep 11 '14 at 10:01
• You're probably right, I had a search but did not find it, which probably says more about my searching skills. – User Sep 11 '14 at 10:13
• I have marked this as "already has an answer" -- please see the link inserted at the top of the Question. Although the examples there show a rectangular array many of the methods work on a ragged array as well. Examples: Prepend[#, 0]& /@ lists and {0, ##} & @@@ lists – Mr.Wizard Sep 11 '14 at 10:14

## 2 Answers

Could be done with:

l = {{b, c}, {d, e, f}};
Join[{a}, #] & /@ l

{{a, b, c}, {a, d, e, f}}

{a, ##} & @@@ {{b, c}, {d, e, f}}
(* {{a, b, c}, {a, d, e, f}}  *)