List Commands Library for 50g
|
07-10-2017, 01:46 AM
(This post was last modified: 09-10-2017 02:19 PM by DavidM.)
Post: #35
|
|||
|
|||
RE: List Commands Library for 50g
It's time for another release...
This one has a few minor changes to existing commands (mostly related to observing system flag 105 to return either exact integers or reals). But most of the energy went into new commands. Several were directly related to suggestions, a couple from trying out Gilles' cryptarithms, and one from my having worked on Joe's recent odd-number challenge. Though not specifically list-related, that last one seemed to fit well with some of the other commands in the library so it made sense to include it. See the included documentation for usage notes. As always, please don't hesitate to ask questions or to make suggestions/comments about better approaches or -- perish the thought -- bug reports. Adding support for the early exit capabilities with DOCOMB and DOPERM was a little trickier than I thought, but not because of the reasons you might think. Setting/checking/observing the flag wasn't the problem. The biggest issue was actually having to alter the supplied user program such that any references to the special flags are converted into local variables. It turns out that the calculator's built-in processing of the user-supplied program assumes those references to be for global variables instead of locals since it doesn't see the locals defined in the code. So I have to seek those out and change them prior to executing the command if they are there. And since they can be nested in layers, finding them involves searching for them recursively in the code object. If I don't do that step, the flags will never be changed by the user-supplied program (and new globals will be created) if you attempt to set the flags. Hopefully the effort (and growing library size) is worth it! Edit: The attachment has been deleted; see the first post in this thread for the latest version. _________________________________________ ListExt Release Notes Version 0.10.0d 2017-07-09 - Added new commands: LPOS, LPOSL, LPROD, RPTCHR, NL→I, LV→I - DOCOMB and DOPERM final results are now returned in a single list. - DOCOMB and DOPERM now allow early exits to be performed based on the user program setting a local flag. - Changed LSUM to return either a real or ZINT 0 for an empty list depending on setting of System Flag 105 (Approximate/Exact Mode). - LRPCT observes System Flag 105 setting for repeat counts (real/zint) - LEQ observes System Flag 105 setting for result (real/zint) - S→NL observes System Flag 105 setting for result (real/zint) - Changed the description of the SL→S command to correct a typo. COMMAND SUMMARY DOCOMB - feeds indicated combinations of a list to a user-supplied program DOPERM - feeds indicated permutations of a list to a user-supplied program LCLLT - collates a list of sublists LCNT - counts objects in a list LDDUP - removes duplicates from a list LDST - distributes list items into sublists (reciprocal of LCLLT) LEQ - checks list items to see if any do not match LGRP - replaces repeated elements with a single instance LHDTL - retrieves the first element in a list while leaving the rest on the stack LMRPT - repeats list contents as indicated by count LNDUP - creates a list by repeating an object as indicated by count LPOS - returns a list of all positions of an object in a list LPOSL - returns a list of all positions of an object in a list or its sublists LPROD - ΠLIST that also accepts lists with 0 or 1 element LRCL - recalls objects identified by variables in a list LREPL - replaces list elements with a substitute object as indicated LRLL - rolls the list (equivalent to 1 LROT) LRLLD - "roll down" the list (equivalent to -1 LROT) LROT - rotates list elements left or right as indicated by count LRPCT - list with LGRP elements and another list of the count of each element LSDIV - subdivides a list into <count> sublists LSEQ - creates a list of <count> integers as a sequence from 1..<count> LSEQR - creates a list of integers for the range specified LSHF - shuffles the contents of a list LSPLT - splits a list as indicated into two sublists LSUM - ΣLIST that also accepts lists with 0 or 1 element LSWP - swaps the positions of two list elements LXIL - explodes inner sublists into individual elements (non-recursive) LXILR - recursive version of LXIL RPTCHR - creates a string of repeated characters S→NL - converts a string to a list of numbers NL→S - converts a list of numbers to a string S→SL - converts a string to a list of characters SL→S - converts a list of characters to a string NL→I - converts a list of numbers to an integer LV→I - converts a list of variables to an integer |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)