Podcast #128: We chat with Kent C Dodds about why he loves React and discuss what life was like in the dark days before Git. Listen now.

6 added 428 characters in body

# Perl 6, 82 bytes

-2 bytes thanks to Jo King

->\n{([-] map {$/=[^n];:10[map {|splice$/,$_,1},[R,] .polymod(1..n-2)]},n+1,n)/9}  Try it online! 0-indexed. Doesn't enumerate all permutations. Should theoretically work for all n, but bails out for n > 65536 with "Too many arguments in flattening array". The following 80 byte version works for n up to 98!-2 and is a lot faster: {([-] map {$/=[^99];:10[map {|splice $/,$_,1},[R,] .polymod(1..97)]},$_+1,$_)/9}


Try it online!

The following 53 byte version should theoretically work for all n, but bails out for n >= 20 with "refusing to permutate more than 20 elements".

{[-](map {:10[$_]},permutations(1..$_+1)[$_,$_-1])/9}


Try it online!

# Perl 6, 82 bytes

-2 bytes thanks to Jo King

->\n{([-] map {$/=[^n];:10[map {|splice$/,$_,1},[R,] .polymod(1..n-2)]},n+1,n)/9}  Try it online! 0-indexed. Doesn't enumerate all permutations. Should theoretically work for all n, but bails out for n > 65536 with "Too many arguments in flattening array". The following 80 byte version works for n up to 98!-2 and is a lot faster: {([-] map {$/=[^99];:10[map {|splice $/,$_,1},[R,] .polymod(1..97)]},$_+1,$_)/9}


Try it online!

# Perl 6, 82 bytes

-2 bytes thanks to Jo King

->\n{([-] map {$/=[^n];:10[map {|splice$/,$_,1},[R,] .polymod(1..n-2)]},n+1,n)/9}  Try it online! 0-indexed. Doesn't enumerate all permutations. Should theoretically work for all n, but bails out for n > 65536 with "Too many arguments in flattening array". The following 80 byte version works for n up to 98!-2 and is a lot faster: {([-] map {$/=[^99];:10[map {|splice $/,$_,1},[R,] .polymod(1..97)]},$_+1,$_)/9}


Try it online!

The following 53 byte version should theoretically work for all n, but bails out for n >= 20 with "refusing to permutate more than 20 elements".

{[-](map {:10[$_]},permutations(1..$_+1)[$_,$_-1])/9}


Try it online!

5 added 578 characters in body

# Perl 6, 8482 bytes

-2 bytes thanks to Jo King

->\n{(($!=[-] map {$/=[^n];:10[map {|splice $/,$_,1},[R,] .polymod(1..n-2)]})(,n+1)-$!(,n))/9}  0-indexed. Doesn't enumerate all permutations. Should theoretically work for all n, but bails out for n > 65536 with "Too many arguments in flattening array". The following 8280 byte version works for n up to 98!-2 and is a lot faster: {(($!=[-] map {$/=[^99];:10[map {|splice$/,$_,1},[R,] .polymod(1..97)]})(,$_+1)-$!(,$_))/9}


# Perl 6, 84 bytes

-2 bytes thanks to Jo King

->\n{(($!={$/=[^n];:10[map {|splice $/,$_,1},[R,] .polymod(1..n-2)]})(n+1)-$!(n))/9}  Try it online! 0-indexed. Doesn't enumerate all permutations. Should theoretically work for all n, but bails out for n > 65536 with "Too many arguments in flattening array". The following 82 byte version works for n up to 98!-2 and is a lot faster: {(($!={$/=[^99];:10[map {|splice$/,$_,1},[R,] .polymod(1..97)]})($_+1)-$!($_))/9}


Try it online!

# Perl 6, 82 bytes

-2 bytes thanks to Jo King

->\n{([-] map {$/=[^n];:10[map {|splice$/,$_,1},[R,] .polymod(1..n-2)]},n+1,n)/9}  Try it online! 0-indexed. Doesn't enumerate all permutations. Should theoretically work for all n, but bails out for n > 65536 with "Too many arguments in flattening array". The following 80 byte version works for n up to 98!-2 and is a lot faster: {([-] map {$/=[^99];:10[map {|splice $/,$_,1},[R,] .polymod(1..97)]},$_+1,$_)/9}


Try it online!

4 added 578 characters in body

# Perl 6, 8284 bytes

-2 bytes thanks to Jo King

->\n{(($!={$/=[^99];=[^n];:10[map {|splice $/,$_,1},[R,] .polymod(1..97n-2)]})($_+1n+1)-$!($_n))/9}  0-indexed. OnlyDoesn't enumerate all permutations. Should theoretically work for all n, but bails out for n > 65536 with "Too many arguments in flattening array". The following 82 byte version works for n up to 98!-2 for now. Doesn't enumerate all permutations.and is a lot faster: {(($!={$/=[^99];:10[map {|splice$/,$_,1},[R,] .polymod(1..97)]})($_+1)-$!($_))/9}


Try it online!

# Perl 6, 82 bytes

-2 bytes thanks to Jo King

{(($!={$/=[^99];:10[map {|splice $/,$_,1},[R,] .polymod(1..97)]})($_+1)-$!($_))/9}  Try it online! 0-indexed. Only works up to 98!-2 for now. Doesn't enumerate all permutations. # Perl 6, 84 bytes -2 bytes thanks to Jo King ->\n{(($!={$/=[^n];:10[map {|splice$/,$_,1},[R,] .polymod(1..n-2)]})(n+1)-$!(n))/9}


Try it online!

0-indexed. Doesn't enumerate all permutations. Should theoretically work for all n, but bails out for n > 65536 with "Too many arguments in flattening array".

The following 82 byte version works for n up to 98!-2 and is a lot faster:

{(($!={$/=[^99];:10[map {|splice $/,$_,1},[R,] .polymod(1..97)]})($_+1)-$!(\$_))/9}


Try it online!

3 added 79 characters in body
2 deleted 9 characters in body
1