Talk:Permutations with repetitions: Difference between revisions
Content added Content deleted
m (→another variant of the: changed the section header name. -- ~~~~) |
(→another variant of the REXX example: fix corrupted program. -- ~~~~) |
||
Line 62: | 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) |
<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 |
<lang rexx>/*REXX*/ parse arg n m s names |
||
if n='' then n= |
if n='' then n=3 |
||
if m='' then m=2 |
|||
if datatype(s,'N') then s=left('',s) |
|||
⚫ | |||
do k=1 to n |
|||
if names='' then e.k=k |
|||
⚫ | |||
end /*k*/ |
end /*k*/ |
||
a='' |
a='' |
||
do i=; a=a'do d'i"=;"; end /*i*/ |
do i=1 to m; a=a'do d'i"=1 to n;"; end /*i*/ |
||
a=a'z=e.d1' |
a=a'z=e.d1' |
||
do j=; a=a"||s||e.d"j; end /*j*/ |
do j=2 to m; a=a"||s||e.d"j; end /*j*/ |
||
a=a';say z'copies(";end",m) |
a=a';say z'copies(";end",m) |
||
if m==; say ', a "null".'; exit; end |
if m==0 then do; say '1 permutation, a "null".'; exit; end |
||
interpret a |
interpret a |
||
say n**m 'permutations'</lang> |
say n**m 'permutations'</lang> |