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


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

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

From Adriano Pascoletti <adriano.pascoletti@uniud.it>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: how to make a list of rules with 2 other lists
Date 2012-07-01 06:06 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <jsopdr$rg$1@smc.vnet.net> (permalink)
References <201206300917.FAA01653@smc.vnet.net>

Show all headers | View raw


Thread[Rule[list1, list2]]


Adriano Pascoletti

2012/6/30 Joug Raw <jougraw@gmail.com>

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

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


Thread

Re: how to make a list of rules with 2 other lists Adriano Pascoletti <adriano.pascoletti@uniud.it> - 2012-07-01 06:06 +0000

csiph-web