RosettaCodeData/Task/Logical-operations/Langur/logical-operations.langur
2024-04-19 16:56:29 -07:00

37 lines
815 B
Text

val .test = fn(.a, .b) join("\n", [
$"not \.a;: \{not .a}",
$"\.a; and \.b;: \.a and .b;",
$"\.a; or \.b;: \.a or .b;",
$"\.a; nand \.b;: \.a nand .b;",
$"\.a; nor \.b;: \.a nor .b;",
$"\.a; xor \.b;: \.a xor .b;",
$"\.a; nxor \.b;: \.a nxor .b;",
"",
$"not? \.a;: \{not? .a}",
$"\.a; and? \.b;: \.a and? .b;",
$"\.a; or? \.b;: \.a or? .b;",
$"\.a; nand? \.b;: \.a nand? .b;",
$"\.a; nor? \.b;: \.a nor? .b;",
$"\.a; xor? \.b;: \.a xor? .b;",
$"\.a; nxor? \.b;: \.a nxor? .b;",
"\n",
])
val .tests = [
[true, false],
[false, true],
[true, true],
[false, false],
# including null...
[true, null],
[null, true],
[false, null],
[null, false],
[null, null],
]
for .t in .tests {
write .test(.t[1], .t[2])
}