The issue is that you want to return the collection of permutations. Just returning [] does not return any permutation, while you want to return a single empty permutation [[]]. The reason I use [l] and not [[]] is that [l] does a proper inference of type of the collection to be produced (and we know that l is empty so [l] will contain one empty collection but with the benefit that it has a proper element type).