JulioHerrlein Posted December 31, 2017 Share 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 Link to comment Share on other sites More sharing options...
JulioHerrlein Posted December 31, 2017 Author Share Posted December 31, 2017 Possible workaround: (remove-duplicates (sort-asc (combination 3 (pcs '6-1))) :test #'equal) Quote Link to comment Share on other sites More sharing options...
opmo Posted December 31, 2017 Share Posted December 31, 2017 as well: (find-unique (sort-asc (combination 3 (pcs '6-1)))) JulioHerrlein 1 Quote Link to comment Share on other sites More sharing options...
JulioHerrlein Posted December 31, 2017 Author Share Posted December 31, 2017 Thanks, Janusz ! Quote Link to comment Share on other sites More sharing options...
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.