Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #10726
| From | Bill Rowe <readnews@sbcglobal.net> |
|---|---|
| Newsgroups | comp.soft-sys.math.mathematica |
| Subject | Re: how to make a list of rules with 2 other lists composed by different kinds of elements |
| Date | 2012-07-01 06:08 +0000 |
| Organization | Steven M. Christensen and Associates, Inc and MathTensor, Inc. |
| Message-ID | <jsopgm$t5$1@smc.vnet.net> (permalink) |
On 6/30/12 at 5:17 AM, jougraw@gmail.com (Joug Raw) wrote:
>I want to generate a list composed by rules. That is,
>I have two list First one: list1={1, 2, 3} >
>Second one: list2= {"file1", "file2", "file3"}
>What I want is to have a new list like list3= {1 -> "file1", 2
>->"file2", 3 -> "file3"}
In[1]:= list1 = Range[3]
Out[1]= {1,2,3}
In[2]:= list2 = "file" <> ToString@# & /@ list1
Out[2]= {file1,file2,file3}
In[3]:= list3 = Rule @@@ Transpose@{list1, list2}
Out[3]= {1->file1,2->file2,3->file3}
Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread
Re: how to make a list of rules with 2 other lists composed by different kinds of elements Bill Rowe <readnews@sbcglobal.net> - 2012-07-01 06:08 +0000
csiph-web