Re: need something like ReplaceAllIndexed[]
- To: mathgroup at smc.vnet.net
- Subject: [mg108499] Re: need something like ReplaceAllIndexed[]
- From: rafscipio <scipionedalferro at yahoo.it>
- Date: Sat, 20 Mar 2010 02:46:08 -0500 (EST)
- References: <hnva5p$88b$1@smc.vnet.net>
On 19 Mar, 08:47, divisor <congruentialumina... at yahoo.com> wrote:
> Hello mathGroup:
>
> I have an expression like this:
>
> b[ a[c], a[c], a[d]]
>
> a list like this:
>
> {e,f,g}
>
> I want to end up with
>
> b[ a[e], a[f], a[g]]
>
> I think of this as interleaving a list into an expression, but all my
> tries with ./,.//,MapIndexed[],MapAt[], Partition[Riffle[]] have come
> to no avail.
>
> Any help on this is greatly appreciated.
>
> Roger Williams
> Franklin Laboratoryhttp://www.youtube.com/congruentlight
Another variation:
In[1]:= x = b[a[c], a[c], a[d]];
In[2]:= y = {e, f, g};
In[3]:= Evaluate[List@@x[[All, 1]]] = y; x
Scipione