array.permutations implemented, List.permutations
re-implemented with a tree of possible outputs