List Commands Library for 50g

02142018, 01:47 AM
Post: #251




RE: List Commands Library for 50g
(02072018 09:10 PM)John Keith Wrote: Capping at 999999999999 would probably be OK. It would be ideal if LMSEQ could return large integers but that would run into the aforementioned speedandcomplexity problem. I've got a working version of the library with an altered sequence generator for LASEQ/LMSEQ/LDSEQ. The new engine still does all of its internal operations with reals so that I can keep it in the Saturn code realm (to optimize performance). In the case where both the first element and the "change value" arguments are exact integers for LASEQ and LMSEQ, the engine will convert individual real results into an exact integer before storing in the result list. LDSEQ always has real values in its result. Examples: Code: 1. 2. 5 LASEQ => { 1. 3. 5. 7. 9. } Code: 1. 2. 10 LMSEQ => { 1. 2. 4. 8. 16. 32. 64. 128. 256. 512. } Intermediate real values greater than +/999999999999.0 are "capped" at +/999999999999 during this conversion process. This means that LMSEQ's usefulness for integers is limited to small result lists, as geometric progressions with integer factors hit the cap very quickly. LASEQ is more likely to be useful with integers, however, since arithmetic progressions won't run into the cap as easily. If either argument is real, the result list will contain all real values. So why bother? Well, the impetus for creating those commands in the ListExt library was performance. Here's some examples of similar GoferLists/ListExt commands that provide the same results: Code: 1 « 2 + » 2000 Iterate Code: 1 2 2000 LASEQ Code: 1. « 2. + » 2000. Iterate Code: 1. 2. 2000. LASEQ Code: 1 « 2 * » 30 Iterate Code: 1 2 30 LMSEQ Code: 1. « 2. * » 30. Iterate Code: 1. 2. 30. LMSEQ I need to do some further testing with this before releasing another beta. But the preliminary results make it appear to be a good alternative to the previous version. 

« Next Oldest  Next Newest »

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