List Manipulation - Printable Version +- HP Forums (https://www.hpmuseum.org/forum) +-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html) +--- Forum: HP Prime (/forum-5.html) +--- Thread: List Manipulation (/thread-19978.html) |
List Manipulation - matalog - 05-19-2023 09:25 PM Is there a way to split a list into 2 or to say that A{}:= B{}(32-64)? So that List A will now contain the 32,33,34.....64th entry in List B as it's first 32 spaces? Short of that is there a way to tail(32)? To remove 32 entries from the beginning of a list? Are there any good List manipulation guides or tutorials? RE: List Manipulation - roadrunner - 05-19-2023 10:50 PM I think you may want the SUPPRESS command. Try the following in HOME: MAKELIST(X,X,1,64)▶la; SUPPRESS(la,1,32); SUPPRESS(la,33,64); -road RE: List Manipulation - gehakte_bits - 05-19-2023 11:03 PM list({a,b}) will return a list from element a to b (or up to size(list)): A:=B({1,32}) should do RE: List Manipulation - gehakte_bits - 05-19-2023 11:06 PM FYI A, B are not list variables, so define a variable list first or use L1 etc. RE: List Manipulation - Didier Lachieze - 05-19-2023 11:09 PM My comments below are related to Home and PPL, not to CAS which may have other ways to manipulate lists. (05-19-2023 09:25 PM)matalog Wrote: Is there a way to split a list into 2 or to say that A{}:= B{}(32-64)? L1:=L2({32,64}) See page 552 of the manual: "List references Suppose L1:={5, "abcde", {1,2,3,4,5}, 11}. L1(1) returns 5 and L1(2) returns "abcde". L1(2, 4) returns 100 (the ASCII code for d) and L1(2,4,1) returns "d". L1({2,4}) returns {"abcde", {1,2,3,4,5},11}, extracting a sublist of all the elements from 2 through 4." One additional thing for list references is about the zero index value: L1(0) returns the last element of the list L1(0):=n adds n as a new element at the end of the list Quote:Short of that is there a way to tail(32)? To remove 32 entries from the beginning of a list? SUPPRESS(L1,1,32) Quote:Are there any good List manipulation guides or tutorials? Nothing I would know, but I may have missed them. RE: List Manipulation - StephenG1CMZ - 05-20-2023 07:10 AM You may find some of the list functions here useful. (The routines in here try to handle edge cases which some of the built-in routines miss). https://www.hpmuseum.org/forum/thread-9411.html?highlight=List It includes a summary of built-in list commands. RE: List Manipulation - matalog - 05-21-2023 11:57 PM That's great, thanks guys. RE: List Manipulation - matalog - 08-24-2023 12:39 PM I have a list A it is 64 bytes, and I want to remove 1 byte. Is there a quicker way to A:=A({1,63}); to remove the last element? |