Permutations: Difference between revisions

(Add SML)
 
(3 intermediate revisions by the same user not shown)
Line 5,691:
This follows the Go language non-recursive example, but is not limited to integers, or even to numbers.
 
<syntaxhighlight lang="langur">val .factorial = ffn .x: if(.x < 2: 1; .x x* self(.x - 1))
 
val .permute = ffn(.list) {
if .list is not isList(.list): throw "expected list"
 
val .limit = 10
if len(.list) > .limit: throw $"permutation limit exceeded (currently \{{.limit;}})"
 
var .elements = .list
Line 5,729:
for .e in .permute([1, 3.14, 7]) {
writeln .e
}
}</syntaxhighlight>
 
{{out}}
890

edits