Permutations improved

permutations.fs now uses List.collect to avoid the need to flatten the
list so the code is now terser. Added a sanity check too.