Re: how to compact many maps?
- To: mathgroup at smc.vnet.net
- Subject: [mg70790] Re: [mg70748] how to compact many maps?
- From: János <janos.lobb at yale.edu>
- Date: Fri, 27 Oct 2006 00:28:49 -0400 (EDT)
- References: <200610260638.CAA19550@smc.vnet.net>
On Oct 26, 2006, at 2:38 AM, Arkadiusz.Majka at gmail.com wrote:
> Hi,
>
> For table of the following structure
>
> tab=Table[{Random[],Random[]},{10},{5}]
>
> I want to apply function f to the second argument of list.
>
> I did:
>
> (MapAt[f, #, 2] & /@ #) & /@ tab
>
> How can I do it in a simpler, more compact way?
>
> Thanks,
>
> Arek
Here is a newbie approach:
In[54]:=
MapAt[f, lst, Flatten[
Table[{i, j, 2}, {i, 10},
{j, 5}], 1]]
Might not be more simpler or compact, but surely more readable :)
János
----------------------------------------------
Trying to argue with a politician is like lifting up the head of a
corpse.
(S. Lem: His Master Voice)
- References:
- how to compact many maps?
- From: Arkadiusz.Majka@gmail.com
- how to compact many maps?