Is there an algorithm to lead all possible combinations of given amount of three-valued logic values?
For example, F(2)
should return this list:
t t
t u
t f
u t
u u
u f
f t
f u
f f
The function would look like this (in Haskell):
data Tril = FALSE | NULL | TRUE
all :: Int -> [[Tril]]
all amount = ???
all1 :: [Tril]
all1 = join (all 1)
all2 :: [(Tril, Tril)]
all2 = map (\[f, s] -> (f, s)) (all 2)
all3 :: [(Tril, Tril, Tril)]
all3 = map (\[f, s, t] -> (f, s, t)) (all 3)