In reply to dave_59:
Hello Dave !
Thanks for your comments.
Getting confused on the solution set of the 2nd part i.e. .sum() / xor.
- Below is the solution set with .or() operator.
array = '{'h9, 'h1, 'h8, 'hc, 'h1, 'h3, 'hd, 'h3, 'h2, 'h4, 'h4, 'h8} and value = d
array = '{'h7, 'h0, 'h4, 'h3, 'h0, 'hb, 'ha, 'h8, 'hd, 'h9, 'h4, 'h3} and value = 0
array = '{'h4, 'hb, 'h1, 'ha, 'he, 'hc, 'h8, 'he, 'h1, 'hb, 'h8, 'h6} and value = e
array = '{'h8, 'hc, 'h3, 'hd, 'h1, 'h8, 'h9, 'h9, 'h1, 'hf, 'h1, 'ha} and value = d
array = '{'hb, 'h9, 'ha, 'hd, 'he, 'h5, 'h8, 'hc, 'he, 'ha, 'h9, 'h9} and value = 8
array = '{'ha, 'h6, 'h3, 'h7, 'h0, 'h7, 'h5, 'h8, 'h3, 'h8, 'h1, 'h8} and value = 7
array = '{'h4, 'h4, 'h9, 'hc, 'h4, 'h2, 'hb, 'ha, 'h9, 'h0, 'h6, 'h1} and value = 4
array = '{'h8, 'hb, 'hc, 'h1, 'h9, 'h9, 'hf, 'h2, 'h9, 'hc, 'hd, 'h0} and value = 9
array = '{'h7, 'h9, 'he, 'ha, 'hf, 'h0, 'h1, 'h2, 'hd, 'hc, 'h6, 'hf} and value = a
array = '{'h4, 'hf, 'h2, 'h9, 'h6, 'h1, 'h1, 'h2, 'hd, 'h3, 'h4, 'h6} and value = 6
- Below is the solution set with .sum() operator.
array = '{'h9, 'h3, 'h0, 'hd, 'h3, 'h6, 'he, 'h3, 'h2, 'h4, 'h4, 'h8} and value = d
array = '{'h7, 'h0, 'h4, 'h3, 'h0, 'hb, 'ha, 'h8, 'hd, 'h9, 'h4, 'h3} and value = 0
array = '{'h4, 'hb, 'h1, 'ha, 'he, 'hc, 'h8, 'he, 'h1, 'hb, 'h8, 'h6} and value = e
array = '{'h8, 'hc, 'h3, 'hd, 'h1, 'h8, 'h9, 'h9, 'h1, 'hf, 'h1, 'ha} and value = d
array = '{'hb, 'h9, 'ha, 'hd, 'he, 'h5, 'h8, 'hc, 'he, 'ha, 'h9, 'h9} and value = 8
array = '{'hb, 'ha, 'hd, 'h0, 'h0, 'h5, 'h7, 'h8, 'h3, 'h8, 'h1, 'h8} and value = 7
array = '{'h4, 'h4, 'h9, 'hc, 'h4, 'h2, 'hb, 'ha, 'h9, 'h0, 'h6, 'h1} and value = 4
array = '{'h1, 'hb, 'hc, 'h1, 'h8, 'h9, 'hf, 'h2, 'h9, 'hc, 'hd, 'h0} and value = 9
array = '{'h7, 'h9, 'he, 'ha, 'hf, 'h0, 'h1, 'h2, 'hd, 'hc, 'h6, 'hf} and value = a
array = '{'h4, 'hf, 'h2, 'h9, 'h6, 'h1, 'h1, 'h2, 'hd, 'h3, 'h4, 'h6} and value = 6
.or() is clear because it make sure at least one element matches the condition. But for the .sum() operator when you say “you would need an odd number of elements matching value” meaning 1 or more [3,5,etc.] elements inside the array between [3:count] should be matching the value is it ?
For Eg: With one element matching,
array = '{'h9, 'h3, 'h0, 'hd, 'h3, 'h6, 'he, 'h3, 'h2, 'h4, 'h4, 'h8} and value = d // Since one d is matching with the value its valid.
Eg with odd number of element matching
array = '{'h9, 'h3, 'h0, 'hd, 'h3, 'hd, 'hd, 'h3, 'h2, 'h4, 'h4, 'h8} and value = d - Since 3 d’s are matching with the value, its valid. Is this correct ?
So “with” expression is like an final “if” condition with 1-bit result ? that is,
if its “or” , and if the results within the “with” is like “1, 0, 1, 0, 0, 0” - Since at least the 1bit result has 1 valid and since its “or” the condition passes.
if its “sum”/“xor”, and if the results within the “with” is like “1, 0, 1, 0, 1, 0” - Since there are 1-bit result with three 1 valid and since its “xor” the condition passes ? So if the number of 1-bit result is 2 for xor then the tool internally wont take up the solution ?
Kindly clarify the same. Thanks for your time !