MathGroup Archive 2009

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

Search the Archive

Combining Lists / Processes

  • To: mathgroup at smc.vnet.net
  • Subject: [mg99153] Combining Lists / Processes
  • From: nick.maj at mssm.edu
  • Date: Wed, 29 Apr 2009 03:46:42 -0400 (EDT)

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: Projection of curley 3D curves to represent a cylindrical
  • Next by Date: Inverse function warnings
  • Previous by thread: Re: Projection of curley 3D curves to represent a cylindrical
  • Next by thread: Re: Combining Lists / Processes