Skip to content

Instantly share code, notes, and snippets.

@canwe
Forked from interstar/permgen.py
Created November 7, 2020 15:05
Show Gist options
  • Select an option

  • Save canwe/e581181364db932a792ef01c3eb2d8be to your computer and use it in GitHub Desktop.

Select an option

Save canwe/e581181364db932a792ef01c3eb2d8be to your computer and use it in GitHub Desktop.

Revisions

  1. phil jones created this gist Feb 25, 2012.
    7 changes: 7 additions & 0 deletions permgen.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,7 @@
    def perm(xs) :
    if xs == [] :
    yield []
    for x in xs :
    ys = [y for y in xs if not y==x]
    for p in perm(ys) :
    yield ([x] + p)