Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
1997
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1997

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

Search the Archive

RE: Horse Race Puzzle (fwd)

  • To: mathgroup at smc.vnet.net
  • Subject: [mg9259] RE: [mg9162] Horse Race Puzzle (fwd)
  • From: Robert Pratt <rpratt at math.unc.edu>
  • Date: Fri, 24 Oct 1997 01:01:14 -0400
  • Sender: owner-wri-mathgroup at wolfram.com

I omitted "{x," in the second replacement rule, which should read
"->{x,Flatten[{y,n}],z}}".  The corrected version appears below.  

> The solutions can be computed recursively using pattern matching as 
> follows:
> 
> HorseRaces[1]={{1}};
> HorseRaces[n_]:=HorseRaces[n]=
> 	Join[
> Flatten[Map[ReplaceList[#,{x___,y___}->{x,n,y}]&,HorseRaces[n-1]],1],
>    Flatten[ReplaceList[#,{x___,y_,z___}->{x,Flatten[{y,n}],z}]&,
> 	HorseRaces[n-1]],1]
> 	]
> 
> Unfortunately, Mathematica seems to ignore the Flatten[{y,n}] command,
> returning 
> {y,n} unflattened.  However, this only gives some unambiguous extra
> nesting in the solutions.



  • Prev by Date: Re: mathematica question
  • Next by Date: Re: mathematica question
  • Previous by thread: Re: Write Protected Functions
  • Next by thread: Re: Re: Horse Race Puzzle (fwd)