Skip to main content
added 231 characters in body
Source Link
kglr
  • 400.5k
  • 18
  • 488
  • 929
Outer[Append, mylist, mysecondlist, 1]
{{{a, b, 1}, {a, b, 2}}, {{c, d, 1}, {c, d, 2}}}

Also

Outer[Join, mylist, List /@ mysecondlist, 1] 

Flatten /@ Tuples[{{#},  mysecondlist}] & /@ mylist

Flatten /@ Thread[{#, mysecondlist}, List, {2}] & /@ mylist 

Distribute[{mylist, mysecondlist}, List, List, Partition[{##}, 2] &, Append]

all give

 {{{a, b, 1}, {a, b, 2}}, {{c, d, 1}, {c, d, 2}}}
Outer[Append, mylist, mysecondlist, 1]
{{{a, b, 1}, {a, b, 2}}, {{c, d, 1}, {c, d, 2}}}

Also

Outer[Join, mylist, List /@ mysecondlist, 1]
 {{{a, b, 1}, {a, b, 2}}, {{c, d, 1}, {c, d, 2}}}
Outer[Append, mylist, mysecondlist, 1]
{{{a, b, 1}, {a, b, 2}}, {{c, d, 1}, {c, d, 2}}}

Also

Outer[Join, mylist, List /@ mysecondlist, 1] 

Flatten /@ Tuples[{{#},  mysecondlist}] & /@ mylist

Flatten /@ Thread[{#, mysecondlist}, List, {2}] & /@ mylist 

Distribute[{mylist, mysecondlist}, List, List, Partition[{##}, 2] &, Append]

all give

 {{{a, b, 1}, {a, b, 2}}, {{c, d, 1}, {c, d, 2}}}
Source Link
kglr
  • 400.5k
  • 18
  • 488
  • 929

Outer[Append, mylist, mysecondlist, 1]
{{{a, b, 1}, {a, b, 2}}, {{c, d, 1}, {c, d, 2}}}

Also

Outer[Join, mylist, List /@ mysecondlist, 1]
 {{{a, b, 1}, {a, b, 2}}, {{c, d, 1}, {c, d, 2}}}