Re: Simple Question -- Incrementing All Elemnts in A list by 1
- To: mathgroup at smc.vnet.net
- Subject: [mg44307] Re: Simple Question -- Incrementing All Elemnts in A list by 1
- From: "Bo Le" <bole79 at email.si>
- Date: Wed, 5 Nov 2003 10:00:30 -0500 (EST)
- References: <bo7pfk$am8$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
simple question - simple answer The addition "+" is done in Mathematica via the function Plus, that has the attribute Listable, which means you can incerement each elements in a list like this: {a,b,c,d,e} + 1 or Plus[{a,b,c,d,e},1] See for yourself, Attributes[Plus], Attributes[Sin] ---} Sin[{0,1,2,10}] Bye, Borut "Thiery Balser" <thiery.balser at gmx.net> wrote in message news:bo7pfk$am8$1 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 > >