Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum: 'use of orderless' topicStudent Support Forum > General > "use of orderless"

Help | Reply To Topic
Author Comment/Response
giorgio borghi
11/30/04 03:41am

i'm trying to implement a 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 . somebody can help me?


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]]]
.....
Length[%]
1023

URL: ,
Help | Reply To Topic