Permutations: Difference between revisions

Content added Content deleted
m (→‎{{header|Sidef}}: updated code)
m (→‎{{header|Wren}}: Minor tidy)
Line 9,886: Line 9,886:
===Recursive===
===Recursive===
{{trans|Kotlin}}
{{trans|Kotlin}}
<syntaxhighlight lang="ecmascript">var permute // recursive
<syntaxhighlight lang="wren">var permute // recursive
permute = Fn.new { |input|
permute = Fn.new { |input|
if (input.count == 1) return [input]
if (input.count == 1) return [input]
Line 9,922: Line 9,922:
{{libheader|Wren-math}}
{{libheader|Wren-math}}
Output modified to follow the pattern of the recursive version.
Output modified to follow the pattern of the recursive version.
<syntaxhighlight lang="ecmascript">import "/math" for Int
<syntaxhighlight lang="wren">import "./math" for Int


var input = [1, 2, 3]
var input = [1, 2, 3]
Line 9,964: Line 9,964:
===Library based===
===Library based===
{{libheader|Wren-perm}}
{{libheader|Wren-perm}}
<syntaxhighlight lang="ecmascript">import "./perm" for Perm
<syntaxhighlight lang="wren">import "./perm" for Perm


var a = [1, 2, 3]
var a = [1, 2, 3]