Re: Transpose to multiple lists
- To: mathgroup at smc.vnet.net
- Subject: [mg55761] Re: [mg55735] Transpose to multiple lists
- From: "Wolf, Hartmut" <Hartmut.Wolf at t-systems.com>
- Date: Tue, 5 Apr 2005 05:45:11 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
>-----Original Message----- >From: konstantpi at mail15.com [mailto:konstantpi at mail15.com] To: mathgroup at smc.vnet.net >Sent: Tuesday, April 05, 2005 9:21 AM >Subject: [mg55761] [mg55735] Transpose to multiple lists > >First Q:Transpose to multiple lists >a={3,6,3,2} >b={9,8,7,6} >Join[Transpose[{Range[Length[a]], a}],Transpose[{Range[Length[b]], b}]] > >Out[]={{1, 3}, {2, 6}, {3, 3}, {4, 2}, {1, 9}, {2, 8}, {3, 7}, {4, 6}} >what are the concise solutions other than this dumby solution > Don't understand, what's concise, what's dumby? >Second Question: transposing Range to every sublist >lst={{4,6,3},{6,8,7,3},{9,4}} >how could i obtain the output: >{{1,4},{2,6},{3,3},{1,6},{2,8},{3,7},{4,3},{1,9},{2,4}} >thanks >konstant. > > To explore your idea use Map: Join @@ Map[Transpose[{Range[Length[#1]], #1}] &, lst] To mark the elements MapIndex may do: Join @@ MapIndexed[{Last[#2], #1} &, lst, {2}] -- Hartmut Wolf