AM Posted February 4, 2021 Share Posted February 4, 2021 (edited) row-permutation (with rule) for n-generations (defun row-permutation (n row rules &key (one-based nil)) (let ((rules (if (equal one-based t) (mapcar '1- rules) rules))) (loop repeat n collect (setf row (position-filter rules row))))) (row-permutation 5 '(a4 c5 cs5 g4 eb5 gs4 e5 d5 f4 b4 bb4 fs4) '(0 1 6 5 2 3 7 8 11 9 4 10)) => ((a4 gs4 eb5 c5 cs5 e5 d5 bb4 f4 g4 b4) (a4 e5 cs5 gs4 eb5 d5 bb4 b4 f4 c5 g4) (a4 d5 eb5 e5 cs5 bb4 b4 g4 f4 gs4 c5) (a4 bb4 cs5 d5 eb5 b4 g4 c5 f4 e5 gs4) (a4 b4 eb5 bb4 cs5 g4 c5 gs4 f4 d5 e5)) (row-permutation 5 '(a4 c5 cs5 g4 eb5 gs4 e5 d5 f4 b4 bb4 fs4) '(1 4 6 5 2 3 7 8 11 9 10 12) :one-based t) => ((a4 g4 gs4 eb5 c5 cs5 e5 d5 bb4 f4 b4 fs4) (a4 eb5 cs5 c5 g4 gs4 e5 d5 b4 bb4 f4 fs4) (a4 c5 gs4 g4 eb5 cs5 e5 d5 f4 b4 bb4 fs4) (a4 g4 cs5 eb5 c5 gs4 e5 d5 bb4 f4 b4 fs4) (a4 eb5 gs4 c5 g4 cs5 e5 d5 b4 bb4 f4 fs4)) Edited February 4, 2021 by AM little bug JulioHerrlein 1 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.