Erweiterung von Jims Ansatz, bei dem „add“ für XOR verwendet wird und einige Matrixfunktionen zum Entfernen der Schleifen verwendet werden ... und eine ASCII-Tabelle.
Diese sind ungetestet. Stellen Sie sicher, dass sie das tun, was Sie erwarten.
char_xor = Function( {a, b}, {aa, bb},
aa = Blob To Matrix( Char To Blob( a ), "int", 1, "little" ); // string to matrix...
bb = Blob To Matrix( Char To Blob( b ), "int", 1, "little" ); // "0" -> 48, "1" -> 49
cc = Mod( aa + bb, 2 ); // XOR, 48+48->0, 48+49->1, 49+49->0
Blob To Char( Matrix To Blob( cc + 48, "int", 1, "little" ) ); // 0->48, 1->49
);
char_or = Function( {a, b}, {aa, bb},
aa = Blob To Matrix( Char To Blob( a ), "int", 1, "little" ); // string to matrix...
bb = Blob To Matrix( Char To Blob( b ), "int", 1, "little" ); // "0" -> 48, "1" -> 49
cc = aa + bb != 96; // OR, 96 is "0"+"0" == 48+48
Blob To Char( Matrix To Blob( cc + 48, "int", 1, "little" ) ); // 0->48, 1->49
);
char_and = Function( {a, b}, {aa, bb},
aa = Blob To Matrix( Char To Blob( a ), "int", 1, "little" ); // string to matrix...
bb = Blob To Matrix( Char To Blob( b ), "int", 1, "little" ); // "0" -> 48, "1" -> 49
cc = Mod( aa, 2 ) :*</img> Mod( bb, 2 ); // AND, :*</img> is element-wise. multiply 0*0, 1*0, 0*1, 1*1
Blob To Char( Matrix To Blob( cc + 48, "int", 1, "little" ) ); // 0->48, 1->49
);
char_not = Function( {a},
Substitute( a, "0", "*", "1", "0", "*", "1" ); // NOT
);
// tests
Show( char_xor( "0011", "0101" ) == "0110",
char_or( "0011", "0101" ) == "0111",
char_and( "0011", "0101" ) == "0001",
char_not( "01" ) == "10" );
p = "00110000011111";
q = "01010101011100";
Show( p, q, char_not( char_and( p, q ) ) == char_or( char_not( p ), char_not( q ) ) ); // De Morgan's Theorem
Möglicherweise möchten Sie Fehlerprüfungen auf ungültige Zeichen wie „010130101“.
Wow. Der Ersatz hat nicht so funktioniert, wie ich dachte.
So können Sie das Problem lösen

For( i = 1, i <= 1, i = i + 15,
loops = Ceiling( Length( :A ) / 15 );
val = "";
For( i = 1, i <= Length( :A ), i = i + 15,
Asub = Substr( :A, i, 15 );
absLength = Length( Asub );
zeros = Repeat( "0", absLength );
Bsub = Substr( :B, i, 15 );
Csub = Sum( Num( Asub ), Num( Bsub ) );
Csub = Format( Csub, "Fixed Dec", 15, 0 );
If( Length( Csub ) != absLength,
Csub = Substr( zeros, 1, absLength - Length( Csub ) ) || Csub
);
val = val || Csub;
);
val = Substitute( val, "2", "0" );
)