Created
October 2, 2018 16:27
-
-
Save sielicki/d67b06ade78a8572148f34a8a7daf990 to your computer and use it in GitHub Desktop.
Table of a boolean function`
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
results = [["X", "Y", "Z", "F"]]; | |
Array.from({ length: 8 }, (_, k) => k).map(x => x.toString(2) | |
.padStart(3, 0)) | |
.map(x => x.split("")) | |
.map(x => x.map(y => Boolean(parseInt(y)))) | |
.map(x => function(a,b,c) { | |
results.push([a,b,c, | |
( | |
// Put your own F here | |
(x, y, z) => ( | |
x && y && z | |
) | |
).apply(null, Array.prototype.slice.call(arguments))]); | |
}(...x)); | |
console.table(results); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment