RosettaCodeData/Task/Permutations-by-swapping/J/permutations-by-swapping-1.j
Ingy döt Net b83f433714 tasks a-s
2013-04-10 23:57:08 -07:00

4 lines
157 B
Text

bfsjt0=: _1 - i.
lookingat=: 0 >. <:@# <. i.@# + *
next=: | >./@:* | > | {~ lookingat
bfsjtn=: (((] <@, ] + *@{~) | i. next) C. ] * _1 ^ next < |)^:(*@next)