Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2002

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

Search the Archive

RE: Changing delayed formula

  • To: mathgroup at
  • Subject: [mg35473] RE: [mg35461] Changing delayed formula
  • From: "DrBob" <majort at>
  • Date: Sun, 14 Jul 2002 06:19:48 -0400 (EDT)
  • Reply-to: <drbob at>
  • Sender: owner-wri-mathgroup at

des = {{11, 12, 13, 14}, {21, 22, 23}, {31, 32}, {41, 42, 43, 44, 45}}
Distribute[des, List]

Bobby Treat

-----Original Message-----
From: Julio Vera [mailto:jvera at] 
To: mathgroup at
Subject: [mg35473] [mg35461] Changing delayed formula


I have a list of lists. it's length (the number of sublists it 
contains) varies.

In[1]:= des={{11,12,13,14},{21,22,23},{31,32},{41,42,43,44,45}}

Out[1]:= {{11,12,13,14},{21,22,23},{31,32},{41,42,43,44,45}}

The length of each of the sublists is arbitrary, too. So I have this 
list of lengths.

In[2]:= elems=Flatten[Table[Dimensions[des[[i]]],{i,Length[des]}]]

Out[2]:= {4,3,2,5}

I want to obtain the list of all combinations of one element of each 
sublist, bounded by &&. This will be a list of 120 elements, each of 
them with 4 components. I define a delayed formula, and apply Array to 
it (the characters printed as bold are subscripts in the Mathematica 


In[4]:= combi=Flatten[Array[condLength[des],elems]]



Since the length of des varies, I would have to define cond each time. 
For instance:


I would like to make a definition for cond that would adapt to these 
changes automatically.

I arrived to this solution, which is not rejected by Mathematica, but 
does not work, either.

In[5]:= d[a_,b_]:=des[[a,b<>"_"]]

In[6]:= Unprotect[ReplaceAll]

Out[6]:= {ReplaceAll}


In fact, I quit the kernel and rerun all the cells except the one 
written here as In[3]. If not, the definition for cond4 remains as it 
was. I was not able to clear cond4 individually.

Thanks very much for anything you can suggest.

Best regards,

Julio Vera

  • Prev by Date: Re: Re: Factoring question
  • Next by Date: Re: Changing delayed formula
  • Previous by thread: Re: Changing delayed formula
  • Next by thread: Re: Changing delayed formula