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

• To: mathgroup at smc.vnet.net
• Subject: [mg127132] Re: how to make a list of rules with 2 other lists composed by different kinds of elements
• From: Bob Hanlon <hanlonr357 at gmail.com>
• Date: Mon, 2 Jul 2012 05:23:34 -0400 (EDT)
• Delivered-to: l-mathgroup@mail-archive0.wolfram.com

```Use Thread

list1 = {1, 2, 3};

list2 = {"file1", "file2", "file3"};

{1 -> "file1", 2 -> "file2", 3 -> "file3"}

{Rule, Rule, Rule}

{Integer, Integer, Integer}

{String, String, String}

Bob Hanlon

On Sat, Jun 30, 2012 at 5:17 AM, Joug Raw <jougraw at gmail.com> wrote:
> 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

--
Bob Hanlon

```

• Prev by Date: Re: Numerical integration over an arbitrary 2D domain
• Next by Date: Evaluate code fragment without making new cell for it?
• Previous by thread: Re: how to make a list of rules with 2 other lists composed by different kinds of elements
• Next by thread: Re: how to make a list of rules with 2 other lists composed by different kinds of elements