Group Abstract Group Abstract

Message Boards Message Boards

0
|
6.8K Views
|
3 Replies
|
0 Total Likes
View groups...
Share
Share this post:
GROUPS:

Stupid newbie question...

Posted 11 years ago
POSTED BY: Thomas Vogler
3 Replies

Is this what you want to do?

In[4]:= ReplacePart[list, 3 -> Sequence @@ replacement]

Out[4]= {{1, 2}, {1/2, 1/3}, {4, 5}, {6, 7}, {1, 2, 3}}
POSTED BY: Frank Kampas

Thank you David,

you made my day!

POSTED BY: Thomas Vogler

Not such a 'noob question'; I have to look up how to do this every other day!

You want the function Sequence; note that it takes a list of arguments, not a single list argument. The @@ below uses the elements of replacement as successive arguments for Sequence.

list = {{1, 2}, {1/2, 1/3}, {3, 4}};
replacement = {{4, 5}, {6, 7}, {1, 2, 3}};
ReplacePart[list, 3 -> Sequence @@ replacement]

Example result

POSTED BY: David Gathercole
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard