Permutations with repetitions: Difference between revisions

Add SML
m (→‎{{header|Wren}}: Changed to Wren S/H)
(Add SML)
 
Line 2,707:
c c
</pre>
 
=={{header|Standard ML}}==
{{trans|Erlang}}
<syntaxhighlight lang="sml">
fun multiperms [] _ = [[]]
| multiperms _ 0 = [[]]
| multiperms xs n =
let
val rest = multiperms xs (n-1)
in
List.concat (List.map (fn a => (List.map (fn b => a::b) rest)) xs)
end
</syntaxhighlight>
 
=={{header|Tcl}}==
23

edits