List Commands Library for 50g
|
07-30-2018, 06:19 PM
Post: #367
|
|||
|
|||
RE: List Commands Library for 50g
More list/string examples
One of my earliest "real" jobs was working at a retail establishment that occasionally sold items that had to be special-ordered. This was a relatively small operation back in the early 80s that didn't have a lot of automation in their POS (point of sale) equipment. In an effort to track the cost information through the sales process, they placed price stickers on these special-ordered items that actually had the internal cost information coded on them with a simple substitution cipher (the digits of the cost were substituted with letters from a predetermined code). It wasn't sophisticated, but it worked for them. As an example, I'll use the word "LOGARITHMS" to represent the digits 0-9 to encode some values to show how simple this actually was (the decimal point was implied): LOGARITHMS 0123456789 123.45 => "OGARI" 99.99 => "SSSS" 10.89 => "OLMS" There's several ways I can think of using standard UserRPL commands to program an encoding algorithm like this. Most involve POS, SUB, SREPL and/or related commands in some kind of loop to convert the numbers into a string containing the substituted characters. A few of the ListExt commands can make this simpler, though. The following shows one such method: Code: PROGRAM STACK DATA The reverse of the above process is also relatively simple: Code: PROGRAM STACK DATA I recall suggesting to the owners that they could accomplish a similar goal with even fewer letters needed on the stickers (and better protection of the info) if they just used a longer code word and converted the cost to a new base which used those letters as the digits. The individual who administered the custom order process gave me the evil eye when she realized that doing so would require more than a simple look at a table to decode the values. Suffice it to say that they never went for it... but you could! The previous post in this thread gives some hints to some handy ListExt commands that would help. Short descriptions of the ListExt commands used above: S→SL: converts a string to a list of characters SL→S: converts a list of characters to a string I→NL: converts an integer to a list of numbers NL→I: converts a list of numbers to an integer LPICK: returns a list containing identified elements in specified order |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 5 Guest(s)