Another solution
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}} *)
Or without usingThe theme of this answer ended up being 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}} *)
Or "playing with Sequence and MapAt"
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}} *)
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}} *)
MapAt[Sequence[Sequence @@ list2, #] &, list1, 3]
EDIT
As mentioned my @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}} *)