Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum: 'LISTS: deleting rotationally equivalent elements' topicStudent Support Forum > General > Archives > "LISTS: deleting rotationally equivalent elements"

< Previous Comment | Next Comment >Help | Reply To Comment | Reply To Topic
Author Comment/Response
yehuda ben-shimol
09/19/06 11:22pm

If you do not mind that the order of the elements in the list is not maintained, this is rather easy
rotEq returns True if the two lists are rotational equivalent, and then this can be used for the SameTest option of Sort
rotEq[l1_List, l2_List] /; Length[l1] == Length[l2] :=MemberQ[NestList[RotateLeft, l2, Length[l2] - 1], l1]
Sort[yourlist, SameTest->rotEq]

good luck

by the way, the definition of ListA in your post is erroneous

regards
yehuda

URL: ,

Subject (listing for 'LISTS: deleting rotationally equivalent elements')
Author Date Posted
LISTS: deleting rotationally equivalent elements Yiannis Proe... 09/19/06 09:30am
Re: LISTS: deleting rotationally equivalent el... yehuda ben-s... 09/19/06 11:22pm
Re: LISTS: deleting rotationally equivalent el... Yiannis Proe... 09/20/06 07:50am
Re: LISTS: deleting rotationally equivalent el... yehuda ben-s... 09/21/06 02:06am
Re: LISTS: deleting rotationally equivalent el... Peter Pein 09/25/06 00:47am
< Previous Comment | Next Comment >Help | Reply To Comment | Reply To Topic