Anonymous user
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. 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=
if m='' then m=2
if
else parse var names e.k names▼
do k=1 to n
if names='' then e.k=k
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>
|