Package for Johnson Trotter permutations algorithm

Hi everyone

I’ve written an implementation of the Johnson Trotter algorithm in Elm, which allows you to get one permutation at a time, instead of getting them all at once. This allows you to stop permuting early, and avoid stack overflow / out of memory


Just for fun I tried wrapping this in a LazyList abstraction (as it might be easier to work with):

(If you want to crash your browser, uncomment the take 1 at the bottom)

1 Like

That does look fun :slight_smile:
Would it make sense to add this to the package? Feel free to open up a PR if so

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.