MathGroup Archive 2009

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

Search the Archive

Re: Combining Lists / Processes

  • To: mathgroup at smc.vnet.net
  • Subject: [mg99221] Re: Combining Lists / Processes
  • From: "Sjoerd C. de Vries" <sjoerd.c.devries at gmail.com>
  • Date: Thu, 30 Apr 2009 06:22:28 -0400 (EDT)
  • References: <gt90kp$kvt$1@smc.vnet.net>

Hi Nick,

Change the last assignment to:

list2 = {list1,
   list1[[All, 1]] /. {x_ /; Mod[x, c] == 0 -> 22,
     y_ /; Mod[y, c] != 0 -> 11}}\[Transpose]

and you're done.

Cheers -- Sjoerd

On Apr 29, 9:46 am, nick.... at mssm.edu wrote:
> a = 3; b = 2; c = a; cutoff = 8;
>
> list1 = Flatten[
>   Table[Partition[Union[Flatten[Range[i, cutoff + i, {a, b}]]], 2,
>     1], {i, 0, cutoff - 1, cutoff}], 1]
>
> {{0, 2}, {2, 3}, {3, 4}, {4, 6}, {6, 8}}
>
> list2 = list1[[All, 1]] /. {x_ /; Mod[x, c] == 0 -> 22,
>    y_ /; Mod[y, c] != 0 -> 11}
>
> {22, 11, 22, 11, 22}
>
> needed output:
> {{{0, 2}, 22}, {{2, 3}, 11}, {{3, 4}, 22}, {{4, 6}, 11}, {{6, 8}, 22}}
>
> is it possible to get the list2 process done inside the table command
> of the list1 process?
>
> thanks in advance, nick.



  • Prev by Date: Re: Simplify exponents in output
  • Next by Date: Re: why is this happening?
  • Previous by thread: Re: Combining Lists / Processes
  • Next by thread: Inverse function warnings