MathGroup Archive 2009

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

Search the Archive

Re: Combining Lists / Processes

  • To: mathgroup at smc.vnet.net
  • Subject: [mg99176] Re: Combining Lists / Processes
  • From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
  • Date: Wed, 29 Apr 2009 06:36:06 -0400 (EDT)
  • Organization: Uni Leipzig
  • References: <gt90kp$kvt$1@smc.vnet.net>
  • Reply-to: kuska at informatik.uni-leipzig.de

Hi,

If[Mod[#[[1]], c] === 0, {#, 22}, {#, 11}] & /@ list1

??

Regards
   Jens

nick.maj 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: Select and Cases Give Different Answers
  • Next by Date: Re: Simplify exponents in output
  • Previous by thread: Combining Lists / Processes
  • Next by thread: Re: Combining Lists / Processes