1,964 reputation
532
bio website
location
age
visits member for 2 years, 10 months
seen 13 mins ago

Dec
4
comment Insert at specific resulting positions?
@andre Thanks for pointing out that the positions list should be sorted ;)
Dec
4
comment Insert at specific resulting positions?
I think that insertF = Fold[Insert[#, #2[[1]], #2[[2]]] &, #, SortBy[Transpose[{#2, #3}], Last]] &; works.
Dec
4
comment Insert at specific resulting positions?
In think the Accumulate@#3 is the problem. Replacing it with just #3 works.
Dec
4
comment Insert at specific resulting positions?
The line of code Fold[Insert[#, #2[[1]], #2[[2]]] &, list0, {{a, 1}, {x,5}}] gives what I want. However the function insertF as you defined it doesn't. In your example with the function, x should be inserted at position 4 of the resulting list.
Dec
4
comment Insert at specific resulting positions?
@andre myInsert[list0,{a,x},{4,1}] should output {x,1,2,a,3,4,5}. The list of positions {4,1} gives the positions of the inserted elements in the resulting list.
Dec
4
comment Insert at specific resulting positions?
@DavidG.Stork I disagree. This produces the desired output (I am the OP ;)). Please tell me why you think this is not consistent with what I asked.
Dec
4
revised Insert at specific resulting positions?
added 67 characters in body
Dec
4
revised Insert at specific resulting positions?
added 52 characters in body
Dec
4
revised Insert at specific resulting positions?
added 52 characters in body
Dec
4
answered Insert at specific resulting positions?
Dec
4
asked Insert at specific resulting positions?
Nov
27
comment Plot a transformed distribution with an If function
How do you draw the vertical line joining the two pieces of Piecewise? Usually I just get a discontinuous plot. I'm studying your code but I don't see it.
Nov
26
comment What graph distributions are available in Mathematica?
@Szabolcs Yes, but it has directed random graphs, random trees. I expect Mathematica to include those too eventually.
Nov
26
comment What graph distributions are available in Mathematica?
@Szabolcs I don't have any reason to believe it is incomplete. It just seemed too small compared to networkx. But I guess your ?*GraphDistribution kind of proves that if there is any additional one, it is "hidden", not part of the "officially supported" Mathematica.
Nov
26
comment What graph distributions are available in Mathematica?
@Szabolcs Is that all? I thought that was just a sample.
Nov
26
asked What graph distributions are available in Mathematica?
Nov
25
asked SubsetQ returns unevaluated
Nov
25
answered How to generate a random tree?
Nov
25
awarded  Citizen Patrol
Nov
24
asked Parallelization and memoization?