Post Reply 
Programming puzzles: processing lists!
06-05-2017, 05:33 PM
Post: #124
RE: Programming puzzles: processing lists!
(06-05-2017 11:48 AM)Gilles59 Wrote:  What about a DOPERM command to handle list permutations.
Something like :

Code:


INPUT
 { 1 2 3 4 }             @ A list
 2                       @ Number of elements for permutation
 << My program >>        @ to handle each permutation
DOPERM
 
OUPUT (If MyProgram does nothing}
{ {1, 2}, {1, 3}, {1, 4},{2, 1}, {2, 3}, {2, 4},{3, 1}, {3, 2}, {3, 4},{4, 1}, {4, 2}, {4, 3} }

I'll think about that. As I'm sure you're aware, the resources of the calculator imply that any command for permutation/combination iteration is likely to have significant limitations. While your given example is certainly feasible, the iterations increase rather quickly with even minimal increases in the numbers. And even if the computation speed can be minimized, processing large lists tends to create memory and garbage collection issues that also hamper overall use of the system. What is the scope of this type of command that you would find reasonable?

@Pier: while we're on this subject, challenge #17 isn't realistic for a 50g, unless I'm totally misunderstanding what you've written. Are you really intending to compute/present all 3628800 permutations? If so, your 50g is somehow very different from mine (and you are far more patient than I am). Smile
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Programming puzzles: processing lists! - DavidM - 06-05-2017 05:33 PM



User(s) browsing this thread: 2 Guest(s)