Permutations with repetitions: Difference between revisions

no edit summary
m (→‎{{header|Ring}}: Remove vanity tags)
No edit summary
Line 1,254:
[B, C, A]
</pre>
 
=={{header|M2000 Interpreter}}==
<lang M2000 Interpreter>
Module Checkit {
a=("A","B","C","D")
n=len(a)
c1=lambda a, n, c (&f) ->{
=(array(a, c),)
c++
if c=n then c=0: f=true
}
m=n-2
While m >0 {
c3=lambda c2=c1, a, n, c (&f) -> {
f=false
=Cons((array(a, c),), c2(&f))
if f then {
c++
f=false
if c=n then c=0: f=true
}
}
c1=c3
m--
}
k=false
While not k {
r=c3(&k)
rr=each(r end to start)
While rr {
Print array$(rr),
}
Print
if array$(r, 2)="B" and array$(r,1)="C" then exit
}
}
Checkit
</lang>
{{out}}
<pre style="height:30ex;overflow:scroll">
A A A
B A A
C A A
D A A
A B A
B B A
C B A
D B A
A C A
B C A
</pre >
 
=={{header|Mathematica}}==
Anonymous user