![]() |
hp prime - programming with lists - Printable Version +- HP Forums (https://archived.hpcalc.org/museumforum) +-- Forum: HP Museum Forums (https://archived.hpcalc.org/museumforum/forum-1.html) +--- Forum: Old HP Forum Archives (https://archived.hpcalc.org/museumforum/forum-2.html) +--- Thread: hp prime - programming with lists (/thread-255287.html) |
hp prime - programming with lists - giancarlo - 11-09-2013 Hello, 1) sort(list) doesn't work with strings. Items are unchanged after 'sort'. 'Sort' does work with numbers. 2) i am not able to delete an item of a list in my program. I was trying to remove a string from a list in vain. Since i wasn't able to remove it, i assigned an empty value "" to it. Do you know which command there is to remove an item from a list? I could write a program to do it in case it doesn't exist.
3) i read somewhere in this forum that the way to assign a string to a variable via a Input() command was to define the variable and assign a value to it like: 4) I defined an input() of a string in a "repeat... until..." loop. When i run into this loop the first time i can entry the string but starting from the second loop, when i see the input screen of the string, i can still see the value i entered during the first run. Did you encouter the same issue? Thanks Giancarlo
P.s. please answers to my points referring to the point numbers i indicated. The reading will be easier.
Re: hp prime - programming with lists - Marcus von Cube, Germany - 11-09-2013 ad 2: remove(what,list) removes the item 'what' from a list. To be precise, 'what' is either a boolean function to identify list items to remove or the value to remove. 'what' is not the position! A workaround could be to replace the item in question by a special value and then use remove() to remove all occurrences of the marker from the list.
Re: hp prime - programming with lists - Patrice - 11-09-2013 1+2) Here is a couple utilities about list handling in a programming point of view. The name come from the language Clipper (xBase)
with examples at the end EXPORT AAdd(Lst, Val_) // add element at end of list Re: hp prime - programming with lists - giancarlo - 11-10-2013 Hello Markus and Patrice, Regarding point 4). Running a loop with an input() command in it is obvious that the local variable maintain the last value entered at each iteration of the loop. Anyway i solved the issue, assigning a "" value at the end of each iteration. At this point only question 3 remains unsolved. Any idea on how to input() a string in a clean way? This is what i tried:
EXPORT PROVA()
LOCAL X1:=""; END
As said at the first post of this thread, i assigned to my local variable an empty string "". When i execute the program, i can see the two "" in the variable entry field at the top of the screen but i use the command line to fill my data and i have to write my string in brackets again. Thanks for any hint in this field.
Giancarlo from cappuccino state
|