HP Forums
delete repeated values or groups in a list - 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: delete repeated values or groups in a list (/thread-17851.html)



delete repeated values or groups in a list - robmio - 12-24-2021 04:53 PM

Good evening everyone and Merry Christmas,

One question: is there a command, in HP PRIME, to delete repeated values or groups in a list?

For instance: {1,1,2,3,4,4,5} --command--> {1,2,3,4,5}


or: {{1,2},{3,4},{1,2},{5,6},{3,4}} --command--> {{1,2},{3,4},{5,6}}

Thanks for the help, Roberto.


RE: delete repeated values or groups in a list - John Keith - 12-24-2021 04:57 PM

(12-24-2021 04:53 PM)robmio Wrote:  One question: is there a command, in HP PRIME, to delete repeated values or groups in a list?

For instance: {1,1,2,3,4,4,5} --command--> {1,2,3,4,5}


or: {{1,2},{3,4},{1,2},{5,6},{3,4}} --command--> {{1,2},{3,4},{5,6}}

UNION works for your first example- it removes duplicates if given a single list as an argument. I'm not sure about your second argument, UNION should work but I don't have my Prime handy.


RE: delete repeated values or groups in a list - robmio - 12-24-2021 05:20 PM

(12-24-2021 04:57 PM)John Keith Wrote:  
(12-24-2021 04:53 PM)robmio Wrote:  One question: is there a command, in HP PRIME, to delete repeated values or groups in a list?

For instance: {1,1,2,3,4,4,5} --command--> {1,2,3,4,5}


or: {{1,2},{3,4},{1,2},{5,6},{3,4}} --command--> {{1,2},{3,4},{5,6}}

UNION works for your first example- it removes duplicates if given a single list as an argument. I'm not sure about your second argument, UNION should work but I don't have my Prime handy.

It works! It works with both the first and the second example!
Thanks for the suggestion, Roberto