Post Reply 
(50g) Removing Objects From Lists Quickly
01-07-2019, 05:19 PM (This post was last modified: 01-09-2019 11:10 PM by John Keith.)
Post: #3
RE: (50g) Removing Objects From Lists Quickly
Thanks, David.

From my (limited) understanding of set theory, the difference function (as well as intersection and, of course, union) should eliminate any duplicates. Set functions in Mathematica work this way. All three of those functions in GoferLists return lists with duplicate objects in some circumstances. I believe that this behavior is erroneous. (Maybe not- see post #11 below.)

Along those lines, I also came up with a similar program for set intersection. It is also much faster than GoferLists' Intersect:

Code:

\<< SWAP DUP ROT LSORT LGRP DUP HEAD UNROT PICK3 OVER SIZE LMRPT LREPL SWAP MPOS LPICK
\>>

The order of commands may seem strange but gives correct results faster than any other program I could come up with. Others are encouraged to improve the code, and especially to test it for correctness.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: (50g) Removing Objects From Lists Quickly - John Keith - 01-07-2019 05:19 PM



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