Talk:Permutations with repetitions: Difference between revisions
Content added Content deleted
(→REXX implementation limits: added another variant of REXX version 2. -- ~~~~) |
(Is the Mathematica solution correct?) |
||
Line 1: | Line 1: | ||
==Mathematica solution incorrect?== |
|||
The task description says combination must be produced one at a time. |
|||
The Mathematica solution uses Tuples, which return a list of all permutations at once. |
|||
Is this a correct solution? |
|||
--[[User:Soegaard|Soegaard]] ([[User talk:Soegaard|talk]]) 14:16, 21 May 2013 (UTC) |
|||
==REXX implementation limits== |
==REXX implementation limits== |
||
Line 6: | Line 12: | ||
For Regina REXX 3.3, 3.4, 3.5, REXX gives a SYNTAX error: |
For Regina REXX 3.3, 3.4, 3.5, REXX gives a SYNTAX error: |
||
:::::: Error |
:::::: Error"C:\xxxxxx.REX", line 29: [Clause >] |
||
For Regina REXX 3.6, 3.7, REXX "crashes" somewhere less than a statement length of 1932, |
For Regina REXX 3.6, 3.7, REXX "crashes" somewhere less than a statement length of 1932, |
||
Line 19: | Line 25: | ||
For what's it worth, I believe REXX should raise the SYNTAX condition. |
For what's it worth, I believe REXX should raise the SYNTAX condition. |
||
[The reason I mention the older versions of Regina REXX is that Regina REXX |
[The reason I mention the older versions of Regina REXX is that Regina REXX<br>virtual memory for those REXX programs which use a ''lot'' of stemmed variables (possibly a |
||
<br>virtual memory for those REXX programs which use a ''lot'' of stemmed variables (possibly a |
|||
<br>memory leak), so the use of the older Regina release is forced in lieu of a fix. |
<br>memory leak), so the use of the older Regina release is forced in lieu of a fix. |
||
For PC/REXX and Personal REXX, it depends on what the RXISA ('''SET''' environmental variable). |
For PC/REXX and Personal REXX, it depends on what the RXISA ('''SET''' environmental variable). |
||
<br>These |
<br>These : |
||
:::::: Error |
:::::: Error:\xxxxxx.REX" Control stack full |
||
<br> |
<br> |
||
:::::: Memory full: symbol |
:::::: Memory full: symbol |
||
:::::: Error |
:::::: Error:\xxxxxx.REX: Machine resources exhausted |
||
somewhere between |
somewhere between. |
||
It should be noted that most people use the maximum for the RXISA (which is |
It should be noted that most people use the maximum for the RXISA (which is. |
||
As far as I can tell, |
As far as I can tell, Rno (real) limitation for the length of an INTERPRET instruction, |
||
<br>and that is probably true of CMS REXX and TSO REXX (it's been too long since I used those |
<br>and that is probably true of CMS REXX and TSO REXX (it's been too long since I used those |
||
<br> |
<br>. |
||
::::::::::: -- [[User:Gerard Schildberger|Gerard Schildberger]] ([[User talk:Gerard Schildberger|talk]]) 20: |
::::::::::: -- [[User:Gerard Schildberger|Gerard Schildberger]] ([[User talk:Gerard Schildberger|talk]]) 20:2013 (UTC) |
||
---- |
---- |
||
==another variant of the |
==another variant of the== |
||
This REXX version: |
This REXX version: |
||
* simplifies many statements |
* simplifies many statements |
||
Line 53: | Line 58: | ||
* eliminates an extra ''';''' (semicolon) from the INTERPRET clause |
* eliminates an extra ''';''' (semicolon) from the INTERPRET clause |
||
* eliminates the need for counting the permutations |
* eliminates the need for counting the permutations |
||
<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: |
<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=='' then m=(s,'N') then s=left('',s) |
||
if m='' then m=2 |
|||
if datatype(s,'N') then s=left('',s) |
|||
do k= |
do k=names='' then e.k=k |
||
if names='' then e.k=k |
|||
else parse var names e.k names |
else parse var names e.k names |
||
end /*k*/ |
end /*k*/ |
||
a='' |
a='' |
||
do i= |
do i=; a=a'do d'i"=;"; end /*i*/ |
||
a=a'z=e.d1' |
a=a'z=e.d1' |
||
do j= |
do j=; a=a"||s||e.d"j; end /*j*/ |
||
a=a';say z'copies(";end",m) |
a=a';say z'copies(";end",m) |
||
if m== |
if m==; say ', a "null".'; exit; end |
||
interpret a |
interpret a |
||
say n**m 'permutations'</lang> |
say n**m 'permutations'</lang> |