RosettaCodeData/Task/Permutations-by-swapping/J/permutations-by-swapping-1.j
2023-07-01 13:44:08 -04:00

4 lines
157 B
Text

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