MathGroup Archive 2005

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

Search the Archive

Re: Transpose to multiple lists


lst = {{4, 6, 3}, {6, 8, 7, 3}, {9, 4}};
f = Transpose@{Range@Length@#, #} &;
f /@ lst

{{{1, 4}, {2, 6}, {3, 3}}, {{1, 6}, {2, 8}, {3, 7}, {4, 3}}, {{1, 9}, {2, 4}}}

Bobby

On Tue, 5 Apr 2005 03:20:53 -0400 (EDT), <konstantpi at mail15.com> wrote:

> 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
>
> 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.
>
>
>
>



-- 
DrBob at bigfoot.com


  • Prev by Date: Re: Recommendations for a programming book?
  • Next by Date: Re: How do I remove operator status?
  • Previous by thread: Transpose to multiple lists
  • Next by thread: Re: Transpose to multiple lists