JulioHerrlein Posted December 31, 2017 Posted December 31, 2017 I need a function to filter the Permutations. For example: (gen-divide 2 (flatten (permute (pcs '4-1)))) Will result in: ((0 1) (2 3) (0 1) (3 2) (0 2) (1 3) (0 2) (3 1) (0 3) (1 2) (0 3) (2 1) (1 0) (2 3) (1 0) (3 2) (1 2) (0 3) (1 2) (3 0) (1 3) (0 2) (1 3) (2 0) (2 0) (1 3) (2 0) (3 1) (2 1) (0 3) (2 1) (3 0) (2 3) (0 1) (2 3) (1 0) (3 0) (1 2) (3 0) (2 1) (3 1) (0 2) (3 1) (2 0) (3 2) (0 1) (3 2) (1 0)) But I don't mind with the order, since I'll make chords out of it, so ((0 1) (2 3) or (0 1) (3 2) or (1 0) (2 3) will result in the same chord. How to filter the list onto a list where the order does not matter ? Best, Julio Quote
JulioHerrlein Posted December 31, 2017 Author Posted December 31, 2017 Possible workaround: (remove-duplicates (sort-asc (combination 3 (pcs '6-1))) :test #'equal) Quote
opmo Posted December 31, 2017 Posted December 31, 2017 as well: (find-unique (sort-asc (combination 3 (pcs '6-1)))) JulioHerrlein 1 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.