MathGroup Archive 2002

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

Search the Archive

RE: Apply and Heads option

  • To: mathgroup at smc.vnet.net
  • Subject: [mg35231] RE: [mg35213] Apply and Heads option
  • From: "David Park" <djmp at earthlink.net>
  • Date: Wed, 3 Jul 2002 05:13:39 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

Ted,

Apply[h, f[y][x]]
h[x]

Apply[h, f[y][x], 1, Heads -> False]
f[y][x]

Apply[h, f[y][x], 1, Heads -> True]
h[y][x]

Apply[h, f[g[y]][g[x]], 2, Heads -> False]
f[g[y]][h[x]]

Apply[h, f[g[y]][g[x]], 2, Heads -> True]
h[h[y]][h[x]]

To change just the head of the head we would use

Operate[h @@ # &, f[g[y]][g[x]]]
h[g[y]][g[x]]

David Park
djmp at earthlink.net
http://home.earthlink.net/~djmp/ 

> From: Ersek, Ted R [mailto:ErsekTR at navair.navy.mil]
To: mathgroup at smc.vnet.net
> 
> 
> Hello mathgroup, 
> ---------
> 
> Apply has the Heads option.  
> Can somebody give an example where 
> Apply[f, expr, Heads->True]   gives a different result than 
> Apply[f, expr, Heads->False].
> 
> OR where 
> 
> Apply[f, expr, levelspec, Heads->True]   gives a different result than 
> Apply[f, expr, levelspec, Heads->False].
> 
> ----------
> Thanks,
>    Ted Ersek
> 
> 


  • Prev by Date: Re: Apply and Heads option
  • Next by Date: The Virtues of Collect[--]
  • Previous by thread: Re: Apply and Heads option
  • Next by thread: RE: Apply and Heads option