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

MathGroup Archive 2004

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

Search the Archive

help on sublists xor

  • To: mathgroup at smc.vnet.net
  • Subject: [mg52506] help on sublists xor
  • From: "gimbo20032003 at libero.it" <gimbo20032003 at libero.it>
  • Date: Tue, 30 Nov 2004 05:24:11 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

hi. i'm  trying to implement a way to mark all binary lists in which three non
overlapping sublists of the same  length(of length >= 3) a, b, and c , where
c  is the result of xor of a and b, in all way they can present (orderless).
But it don't work , specially orderless. somebody can help me? any help
will be apreciate.

  giorgio

ZeroPad[x__] :=(*Takes Transpose after zero - padding*)Module[{l, y =
Map[(#
/. d_Integer :> IntegerDigits[d, 2]) &, {x}]}, l = Map[Length, y];
Transpose[MapThread[Join[Table[0, {Max[l] - #1}], #2] &, {l, y}]]]

BitwiseXor[x__] := Flatten[Apply[Mod[Plus[##], 2] &, ZeroPad[x], {1}]]

<< DiscreteMath`Combinatorica`

SetAttributes[mm, Orderless]
mmQ[t1, t2, t3] := True /; (BitwiseXor[t1, t2] == t3) && (Length[t1]
= 3) && (
Length[t2] = 3) && (Length[t3] = 3)

m[{x1___, a1__, x2___, a2__, x3___, a3__, x4___}] := {} /; mmQ[{a1}, {
a2}, {a3}]
m[l_] := l
t1 = Strings[{0, 1}, 10];
Rest[Union[Map[m, t1]]]


  • Prev by Date: use of orderless
  • Next by Date: Re: sort procedure
  • Previous by thread: use of orderless
  • Next by thread: pair functions applied to Zeta function in two ways