Data update
This commit is contained in:
parent
ed705008a8
commit
0df55f9f24
2196 changed files with 32999 additions and 3075 deletions
|
|
@ -1,18 +1,18 @@
|
|||
val .factorial = f if(.x < 2: 1; .x x self(.x - 1))
|
||||
|
||||
val .permute = f(.arr) {
|
||||
if not isArray(.arr): throw "expected array"
|
||||
val .permute = f(.list) {
|
||||
if not isList(.list): throw "expected list"
|
||||
|
||||
val .limit = 10
|
||||
if len(.arr) > .limit: throw $"permutation limit exceeded (currently \.limit;)"
|
||||
if len(.list) > .limit: throw $"permutation limit exceeded (currently \.limit;)"
|
||||
|
||||
var .elements = .arr
|
||||
var .elements = .list
|
||||
var .ordinals = pseries len .elements
|
||||
|
||||
val .n = len(.ordinals)
|
||||
var .i, .j
|
||||
|
||||
for[.p=[.arr]] of .factorial(len .arr)-1 {
|
||||
for[.p=[.list]] of .factorial(len .list)-1 {
|
||||
.i = .n - 1
|
||||
.j = .n
|
||||
while .ordinals[.i] > .ordinals[.i+1] {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import "/math" for Int
|
||||
import "./math" for Int
|
||||
|
||||
var input = [1, 2, 3]
|
||||
var perms = [input]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue