Hi! Thanks very much for this excellent code and accompanying blog post.
One thing I stumbled across in pouring over this to implement my own: I think there's an extraneous comparison in permutation-to-transpositions. In lines 79–83, we've got
(loop :while (< src dest) :do
(setf src (elt permutation src)))
(cond
((< src dest) (push (cons src dest) swaps)) ;; <- this one here
((> src dest) (push (cons dest src) swaps)))))))
Since we loop as long as src is less than dest, will we ever need the first branch of this cond? Can we replace it with just (when (> src dest) …)?
Thanks again!
Hi! Thanks very much for this excellent code and accompanying blog post.
One thing I stumbled across in pouring over this to implement my own: I think there's an extraneous comparison in
permutation-to-transpositions. In lines 79–83, we've gotSince we
loopas long assrcis less thandest, will we ever need the first branch of thiscond? Can we replace it with just(when (> src dest) …)?Thanks again!