MathGroup Archive 2005

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

Search the Archive

Re: Applying function to nested lists


Kerry Kim schrieb:
> Hello,
> 
> I'm trying to get Mathematica to do the following:
> 
> Suppose
> x = {{1,2,3},{{4,5,6},7,8},9}
> f = some function
> 
> How can I get f applied to each element of x but with the list structure 
> intact?  I.e. I want something that generates:
> 
> {{f[1],f[2],f[3]},{{f[4],f[5],f[6]},f[7],f[8]},f[9]}
> 
> Thank you!
> -Kerry Kim
> 

Map[f, x, {-1}] is what you're looking for.

-- 
Peter Pein
Berlin


  • Prev by Date: Beginner's Question on I/O Files for Raw Numerical Data
  • Next by Date: Re: saving the kernel
  • Previous by thread: Re: Beginner's Question on I/O Files for Raw Numerical Data
  • Next by thread: Re: Applying function to nested lists