Post Reply 
Programming puzzles: processing lists!
10-31-2017, 11:42 AM (This post was last modified: 10-31-2017 11:43 AM by DavidM.)
Post: #215
RE: Programming puzzles: processing lists!
(10-31-2017 10:43 AM)pier4r Wrote:  Say one has a list with values, of which one appears several times and one wish to remove it.

Fastest way to remove it?
Most compact way?

Another fairly simple way would be to use MPOS and LRMOV from ListExt. Given a list and an object on the stack, the following should work:
Code:
\<<
   OVER SWAP MPOS LRMOV
\>>

Deleting all of the 5's from 100 repeats of a 1-50 sequence (ie. a 5000-element list with 100 matches) took 3.89s. How does that compare with the string version?
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Programming puzzles: processing lists! - DavidM - 10-31-2017 11:42 AM



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