Skip to main content
edited body
Source Link

As mentioned myby @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:

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:

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:

added 1099 characters in body
Source Link

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]

error

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}} *)
    

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 using 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

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]

error

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}} *)
    
 MapAt[Sequence[Sequence @@ list2, #] &, list1, 3]

error

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}} *)
    
added 500 characters in body
Source Link

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 using 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

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

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}}  *)

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 using 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

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

Post Undeleted by userrandrand
deleted 932 characters in body
Source Link
Loading
Post Deleted by userrandrand
Source Link
Loading