Skip to main content
5 of 5
edited body

The theme of this answer ended up being : "playing with Sequence and MapAt"

  • Using MapAt, Apply, Sequence and Insert:

    MapAt[Apply[Sequence], Insert[list1, list2, 3], 3]
    
    (* {{1, -1.1}, {2, -1}, {2, -0.6}, {3, -0.6}, {3, -0.9}, {4, 
       0}, {10, -0.4}}  *)
    
  • Using MapAt, Sequence, Apply, Join, List and Function (no Insert):

    MapAt[Sequence @@ list2~Join~{#} &, list1, 3]
    
     (* {{1, -1.1}, {2, -1}, {2, -0.6}, {3, -0.6}, {3, -0.9}, {4, 
      0}, {10, -0.4}} *)
    
  • Using MapAt, Construct, Sequence, Apply, and Function (no Insert):

    MapAt[Construct[Sequence, Sequence @@ list2, #] &, list1, 3]
    
     (* {{1, -1.1}, {2, -1}, {2, -0.6}, {3, -0.6}, {3, -0.9}, {4, 
      0}, {10, -0.4}} *)
    

but

 MapAt[Sequence[Sequence @@ list2, #] &, list1, 3]

leads to an error

error

EDIT

As mentioned by @att in the comments, the error is due to the fact that Function does not have the attribute SequenceHold. For workarounds for this issue see the answers here. Some of the workarounds from that question including the one by @att applied to this case are:

  • Using MapAt, Sequence (x2), Apply, and Function(x2) (no Insert):

      MapAt[##&[Sequence @@ list2, #] &, list1, 3]
    
     (* {{1, -1.1}, {2, -1}, {2, -0.6}, {3, -0.6}, {3, -0.9}, {4, 
       0}, {10, -0.4}}  *)
    
  • Using MapAt, Sequence (x2), Apply(x2), and Function (no Insert):

     MapAt[Sequence @@ {Sequence @@ list2, #} &, list1, 3]
    
    (* {{1, -1.1}, {2, -1}, {2, -0.6}, {3, -0.6}, {3, -0.9}, {4, 
      0}, {10, -0.4}} *)