summary refs log blame commit diff stats
path: root/tests/stdlib/tpermutations.nim
blob: a6e07ded6fe22d6d066441a10817cce76e4e0c88 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
           









                       


                

                          
        
                          
        
discard """
  output: '''@[0, 2, 1]
@[1, 0, 2]
@[1, 2, 0]
@[2, 0, 1]
@[2, 1, 0]
@[2, 0, 1]
@[1, 2, 0]
@[1, 0, 2]
@[0, 2, 1]
@[0, 1, 2]'''
"""
import algorithm

var v = @[0, 1, 2]
while v.nextPermutation():
  echo v
while v.prevPermutation():
  echo v