Talk:Permutations with repetitions: Difference between revisions

→‎another variant of the REXX example: fix corrupted program. -- ~~~~
m (→‎another variant of the: changed the section header name. -- ~~~~)
(→‎another variant of the REXX example: fix corrupted program. -- ~~~~)
Line 62:
<br>If any of these improvements could/would be of use, that's fine. &nbsp; I plan to delete this entry in a couple of weeks. -- [[User:Gerard Schildberger|Gerard Schildberger]] ([[User talk:Gerard Schildberger|talk]]) 04:2013 (UTC)
<lang rexx>/*REXX*/ parse arg n m s names
if n='' then n=='' then m=(s,'N') then s=left('',s)3
if m='' then m=2
 
if do k=names=datatype(s,'N' ) then e.ks=kleft('',s)
else parse var names e.k names
do k=1 to n
if names='' then e.k=k
else parse var names e.k names
end /*k*/
a=''
do i=1 to m; a=a'do d'i"=1 to n;"; end /*i*/
a=a'z=e.d1'
do j=2 to m; a=a"||s||e.d"j; end /*j*/
 
a=a';say z'copies(";end",m)
if m==0 then do; say '1 permutation, a "null".'; exit; end
interpret a
say n**m 'permutations'</lang>