MathGroup Archive 2010

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: need something like ReplaceAllIndexed[]

  • To: mathgroup at smc.vnet.net
  • Subject: [mg108489] Re: need something like ReplaceAllIndexed[]
  • From: rafscipio <scipionedalferro at yahoo.it>
  • Date: Sat, 20 Mar 2010 02:44:17 -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

Just to add another way:

In[1]:= x = b[a[c], a[c], a[d]];

In[2]:= y = {e, f, g};

In[3]:= Inner[(#1[#2]) &, Level[x[[All, 0]], 1], y, Head@x]

Scipione


  • Prev by Date: Re: need something like ReplaceAllIndexed[]
  • Next by Date: Re: Alignment -> Full not working in GraphicsColumn
  • Previous by thread: Re: need something like ReplaceAllIndexed[]
  • Next by thread: Re: need something like ReplaceAllIndexed[]