List Commands Library for 50g
|
07-10-2017, 03:39 PM
Post: #38
|
|||
|
|||
RE: List Commands Library for 50g
I was intrigued by Gilles' post referencing the "cryptarithms". Although I've seen them before, I hadn't really spent any time pondering them or their cousins (it seems to me that would include things like the Vietnamese Snake Puzzle and Sudoku). Playing around with a couple of them inspired the creation of a couple of new commands in the library, though.
Following the Wiki link to some examples at the cut-the-knot website showed an example that I couldn't pass up trying, mostly because it seemed directed squarely at me regarding my strange affection for these machines: Code: L O T S I quickly saw that a common need for this type of problem was having an ability to translate groups of variables into integers. It seemed like such a feature would also benefit other types of problems as well, and thus the commands NL→I and LV→I were born. Setting up a test for the above "word addition" then becomes: Code: { L O T S } LV→I I also recognized that while it's easy to store a list of values into a list of variables: Code: { 1 2 3 } { A B C } STO There wasn't an apparent counterpart for recalling them (hence Gilles using DOLIST for that purpose). { A B C } RCL would seem fairly intuitive as a construct, but that syntax was already designed to be used in a different way (it specifies a directory path instead of a list of objects). So LRCL was created to streamline that process. Code: { A B C } LRCL => { 1 2 3 } It also makes short work of creating a list which shows the labeled contents of variables: Code: { A B C } DUP LRCL = ...creates the following list: Code: { A=1 B=2 C=3 } |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)