MathGroup Archive 1997

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

Search the Archive

programing: reduce list to cycle

  • To: mathgroup at smc.vnet.net
  • Subject: [mg8468] programing: reduce list to cycle
  • From: "Xah" <xah at best.com>
  • Date: Tue, 2 Sep 1997 16:15:04 -0400
  • Organization: smtp.best.com
  • Sender: owner-wri-mathgroup at wolfram.com

Another prograMing question.

I want to reduce a list to its shortest cycle. For example, if
myList={3,1,0,3,3,1,0,3,3,1,0,3}, then the desired result should be
{3,1,0,3}. How to do it?

The input list is not necessarily a repeation like in this example. e.g. if
myList={3,1,0,3,3,1,0,3,3,1,0}, then the result should be the whole thing.
myList is not necessarily a list of numbers. I'm using them for simplicity.

Thanks to all the replies on spliting a list.

 Xah, xah at best.com
 http://www.best.com/~xah/MathGraphicsGallery_dir/mathGraphicsGallery.html
 "programer not programmer"


  • Prev by Date: prograMing: create a cycled matrix
  • Next by Date: Re: Flat: Problems & Workarounds
  • Previous by thread: prograMing: create a cycled matrix
  • Next by thread: Re: programing: reduce list to cycle