Post Reply 
HP 48GX - Store Coordinates in a List
04-03-2021, 02:25 PM
Post: #10
RE: HP 48GX - Store Coordinates in a List
(04-01-2021 09:21 PM)MNH Wrote:  
(03-31-2021 09:27 PM)BruceH Wrote:  Maybe I could do something like this after point # 100 is stored:
{100 100 {100 [5000 5000] "PROP COR"}}, where 100 is the starting index and 100 is the ending index.
What I meant by starting and ending indexes, is they are a way to keep track of the lowest point number in the list and how many elements are in the list. Since I don't need any empty lists in the list to act as placeholders, and there doesn't need to be any correspondence between the list elements and their position in the list, all that is irrelevant.

Ah, I see. Given the amount of code needed to check each new value against the lowest and highest and fiddle around updating the beginning of the list it is probably easier to just calculate the highest and lowest on demand and not try to track them at all. (An added benefit is that then you don't need a special "add point to list" routine.) The following example finds the lowest value:

Code:
2: {{100 [5000 5000] "PROP COR"} {77 [7000 7000] "PROP BCK"}}
1: << -> a b 'IFTE(a(1) < b(1), a, b)' >>
STREAM

Just change the < to > in the IFTE statement to get the highest element from the list.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: HP 48GX - Store Coordinates in a List - BruceH - 04-03-2021 02:25 PM



User(s) browsing this thread: