Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #10728

Re: how to make a list of rules with 2 other lists composed by

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!npeer03.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!nx02.iad01.newshosting.com!newshosting.com!newspump.sol.net!post2.nntp.sol.net!posts.news.twtelecom.net!nnrp2.twtelecom.net!not-for-mail
From nanobio9 <kuokan.liang@gmail.com>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: how to make a list of rules with 2 other lists composed by
Date Sun, 1 Jul 2012 06:10:55 +0000 (UTC)
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Sender steve@smc.vnet.net
Approved Steven M. Christensen <steve@smc.vnet.net>, Moderator
Message-ID <jsoplf$vb$1@smc.vnet.net> (permalink)
References <jsmgat$1l5$1@smc.vnet.net>
Lines 38
NNTP-Posting-Date 01 Jul 2012 06:15:39 GMT
NNTP-Posting-Host 55f9191e.news.twtelecom.net
X-Trace DXC=<N_TeZ[UDoeaL?CIe5<=HmC_A=>8kQj6m;[h;PUXBgbdEb>go=kRSofEFiONJ7[Gof_=f4J8HJJjk
X-Complaints-To abuse@twtelecom.net
X-Received-Bytes 2155
Xref csiph.com comp.soft-sys.math.mathematica:10728

Show key headers only | View raw


Joug Raw=E6=96=BC 2012=E5=B9=B46=E6=9C=8830=E6=97=A5=E6=98=9F=E6=9C=9F=E5=
=85=ADUTC+8=E4=B8=8B=E5=8D=885=E6=99=8219=E5=88=8625=E7=A7=92=E5=AF=AB=E9=
=81=93=EF=BC=9A
> Dear all,
>
> I want to generate a list composed by rules. That is,
>
> I have two list
> First one:
> list1={1, 2, 3}
> The elements of this list are Integers.
> Map[Head, list1] = {Integer, Integer, Integer}
>
> Second one:
> list2= {"file1", "file2", "file3"}
> The elements of this list are Strings.
> Map[Head, list2] = {String, String, String}
>
>
> What I want is to have a new list like
> list3= {1 -> "file1", 2 -> "file2", 3 -> "file3"}
> Map[Head, list3] = {Rule, Rule, Rule}
>
> Yes, of cause I can generate a list of rule manually. But what I have are
> two big list of many elements and they are the output of other codes. So,
> in real life this would be a part of big program. That is why I want to
> generate the rule list automatically from list1 and list2. How could I do
> this in a simple way? Thank you for your help.
>
> Best regards,
> Joug

Hi, the example you posted was so simple that the solution should be as simple as
list3 = Inner[ Rule, list1, list2, List ]
But if you are actually talking about more complicated cases, please tell us more about the difficulties you had.

Best.

Back to comp.soft-sys.math.mathematica | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

how to make a list of rules with 2 other lists composed by different kinds of elements Joug Raw <jougraw@gmail.com> - 2012-06-30 09:19 +0000
  Re: how to make a list of rules with 2 other lists composed by nanobio9 <kuokan.liang@gmail.com> - 2012-07-01 06:10 +0000

csiph-web