( (defun permutations_inner (pre post agg) (if (not post) agg (assign myatom (f post) newrest (r post) (map (lambda ((& myatom) x) (c myatom x)) (permutations (prepend pre newrest)) (permutations_inner (c myatom pre) newrest agg) ) ) ) ) (defun permutations (vals) (if vals (permutations_inner 0 vals 0) (q ()) ) ) )