Permutations with repetitions: Difference between revisions

Added Easylang
(Add SML)
(Added Easylang)
 
Line 796:
}</syntaxhighlight>
The output is the same.
 
=={{header|EasyLang}}==
{{trans|Wren}}
<syntaxhighlight>
n = 3
values$[] = strchars "ABCD"
#
func decide pc$[] .
return if pc$[1] = "B" and pc$[2] = "C"
.
for i to n
pn[] &= 1
.
len pc$[] n
repeat
for i to len pn[]
pc$[i] = values$[pn[i]]
.
print strjoin pc$[]
until decide pc$[] = 1
i = 1
repeat
pn[i] += 1
until pn[i] <= len values$[]
pn[i] = 1
i += 1
if i = n
print "done"
break 2
.
.
.
</syntaxhighlight>
{{out}}
<pre>
AAA
BAA
CAA
DAA
ABA
BBA
CBA
DBA
ACA
BCA
</pre>
 
=={{header|EchoLisp}}==
2,078

edits