Files
Nim/tests/stdlib/tpermutations.nim
def 03db4d2930 Adapt the tester for permutations
Uses the bool return value now
2015-02-02 08:06:19 +01:00

20 lines
251 B
Nim

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