Data update
This commit is contained in:
parent
0df55f9f24
commit
aec8ed51b6
1045 changed files with 18889 additions and 2777 deletions
|
|
@ -1,7 +1,7 @@
|
|||
val .factorial = f if(.x < 2: 1; .x x self(.x - 1))
|
||||
val .factorial = fn(.x) if(.x < 2: 1; .x * self(.x - 1))
|
||||
|
||||
val .permute = f(.list) {
|
||||
if not isList(.list): throw "expected list"
|
||||
val .permute = fn(.list) {
|
||||
if .list is not list: throw "expected list"
|
||||
|
||||
val .limit = 10
|
||||
if len(.list) > .limit: throw $"permutation limit exceeded (currently \.limit;)"
|
||||
|
|
|
|||
5
Task/Permutations/Standard-ML/permutations.ml
Normal file
5
Task/Permutations/Standard-ML/permutations.ml
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
fun interleave x [] = [[x]]
|
||||
| interleave x (y::ys) = (x::y::ys) :: (List.map (fn a => y::a) (interleave x ys))
|
||||
|
||||
fun perms [] = [[]]
|
||||
| perms (x::xs) = List.concat (List.map (interleave x) (perms xs))
|
||||
Loading…
Add table
Add a link
Reference in a new issue