Re: Simple Question -- Incrementing All Elemnts in A list by 1
- To: mathgroup at smc.vnet.net
 - Subject: [mg44368] Re: [mg44290] Simple Question -- Incrementing All Elemnts in A list by 1
 - From: Dr Bob <drbob at bigfoot.com>
 - Date: Fri, 7 Nov 2003 05:16:11 -0500 (EST)
 - Organization: Interstellar Corps of Engineers
 - Reply-to: drbob at bigfoot.com
 - Sender: owner-wri-mathgroup at wolfram.com
 
Try
Map[# + 1 &, {2, 3, 4, 45, 98}]
{3, 4, 5, 46, 99}
or (much simpler)
{2, 3, 4, 45, 98} + 1
{3, 4, 5, 46, 99}
Bobby
Simple Question -- Incrementing All Elemnts in A list by 1
Subject: [mg44368] [mg44290] Simple Question -- Incrementing All Elemnts in A list 
by 1
From: "Thiery Balser" <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