A boolean value interview question(pixelstech.net)
pixelstech.net
A boolean value interview question
http://pixelstech.net/article/index.php?id=1335793772
3 comments
Thank you for your remind. We have corrected the error. Yes, you are right, these two solutions have the same logic.
(defn at_least_2 [a b c]
(>= (count (filter true? [a b c])) 2))
Are expressing exactly the same idea- When A and B are identical, they will xor to 0, and otherwise something nonzero. Thus, xor can be thought of in general as a "!=" operator, provided booleans work like you'd expect in C.