Calculators that allow direct operations on data stored on persistent storage?
03-01-2018, 06:15 PM
Post: #12
 DavidM Senior Member Posts: 853 Joined: Dec 2013
RE: Calculators that allow direct operations on data stored on persistent storage?
Here's an example of some helper routines that would translate some of your data back and forth between a list format and storage format. The ListExt library is required for several of the commands. I realize that your actual data doesn't match the format I'm using here, but I wanted to show several different examples in these two routines to illustrate how the conversions could be done.

In the above example, a vector was shown that appeared to have the data for a given day. I've converted it to a list for this example:
Code:
{ 20.062017 5. 4. 0. 2. 4. 3. 3. 4. 2. 3. 0. 4. 4. 3. 4. 2. 0. 0. 360. }

Using that same data as the starting point, the following code will convert the list to a string representation:
Code:
\<<   @ convert date to padded offset   LPOP 1.012017 SWAP DDAYS 1E5 + LPUSH   @ pad final number   LPOPR 1E3 + +   @ convert list to integer   NL\->I   @ convert integer to string of "safe" ascii chars   92 I\->BL NL\->S 35 CHR+ \>>

The padding is required to make sure that the first and last entries always use a consistent number of digits.

The result of the above routine with the specified data becomes "@[PXTS*M'H4iT7". That's not very useful in terms of readability, but for storage it's only 19 bytes compared to the 71 bytes used by the list. You could easily save even more by stringing together multiple day's worth of entries.

The following is the reciprocal to the above:
Code:
\<<   @ expand alpha string to integer string   -35 CHR+ S\->NL 92 BL\->I \->STR   \-> str   \<<     @ convert date part     1.012017 str 2 6 SUB STR\-> DATE+     @ convert single digit entries     str 7 24 SUB -48 CHR+ S\->NL +     @ convert final entry     str 26 28 SUB STR\-> +   \>> \>>
 « Next Oldest | Next Newest »

 Messages In This Thread Calculators that allow direct operations on data stored on persistent storage? - pier4r - 02-18-2018, 03:00 PM RE: Calculators that allow direct operations on data stored on persistent storage? - mfleming - 02-18-2018, 04:12 PM RE: Calculators that allow direct operations on data stored on persistent storage? - DavidM - 02-18-2018, 07:32 PM RE: Calculators that allow direct operations on data stored on persistent storage? - pier4r - 02-18-2018, 08:40 PM RE: Calculators that allow direct operations on data stored on persistent storage? - Claudio L. - 02-23-2018, 10:09 PM RE: Calculators that allow direct operations on data stored on persistent storage? - Garth Wilson - 02-19-2018, 03:31 AM RE: Calculators that allow direct operations on data stored on persistent storage? - pier4r - 02-24-2018, 11:15 AM RE: Calculators that allow direct operations on data stored on persistent storage? - DavidM - 02-24-2018, 07:50 PM RE: Calculators that allow direct operations on data stored on persistent storage? - Garth Wilson - 02-24-2018, 08:21 PM RE: Calculators that allow direct operations on data stored on persistent storage? - Claudio L. - 02-24-2018, 09:04 PM RE: Calculators that allow direct operations on data stored on persistent storage? - Carsen - 02-24-2018, 03:54 PM RE: Calculators that allow direct operations on data stored on persistent storage? - DavidM - 03-01-2018 06:15 PM

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