I am trying to implement a function that takes a number n and returns a list of logical element lists containing all possible combinations of n Booleans. The output, for example (make-bools 3) should look like
[[false false false] [false false true ] [false true false] [false true true ] [true false false] [true false true ] [true true false] [true true true ]]
I was thinking about converting numbers from 0 to (2 ^ n) - 1 in binary format and use bit-test to make a list of logical elements, finally linking all these lists. But that seems rather awkward to me, and I believe there should be a more elegant solution.
source share