MathGroup Archive 2003

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

Search the Archive

RE: Simple Question -- Incrementing All Elemnts in A list by 1


Thiery,

Isn't that just what pure functions are for?

# + 1 & /@ {2, 3, 4, 45, 98}
{3, 4, 5, 46, 99}

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


From: Thiery Balser [mailto:thiery.balser at gmx.net]
To: mathgroup at smc.vnet.net

Hi,

I'm sort of stuck.

I would like to have all elements in a list incremted by a given number
without defining a supplementary function.

What I've done so far is:

incFunc[n_]:=n+1;
Map[incFunc,{2,3,4,45,98}]

which is all fine. It is only that I'm looking for a solution _without_
defining the mentioned function incFunc.


Thanks in advance,

Thiery



  • Prev by Date: Re: FourierTransform of Sinc Function
  • Next by Date: Re: Simple Question -- Incrementing All Elemnts in A list by 1
  • Previous by thread: Re: Simple Question -- Incrementing All Elemnts in A list by 1
  • Next by thread: Re: Simple Question -- Incrementing All Elemnts in A list by 1