Post Reply 
Bug? Tricky syntax? Finding items in a list
11-04-2017, 09:36 AM (This post was last modified: 11-04-2017 09:38 AM by StephenG1CMZ.)
Post: #5
RE: Bug? Tricky syntax? Finding items in a list
(11-03-2017 04:19 PM)Carlos295pz Wrote:  This is a little faster

Code:

EXPORT ListFIND2(LST,ITEM)
BEGIN
  LOCAL X,Y;
  LOCAL LSTPOSNS={};

  WHILE X:=POS(LST,ITEM) DO
    LSTPOSNS(0):=(Y:=X+Y);
    LST:=LST({X,SIZE(LST)}+1)
  END;

  RETURN LSTPOSNS;

END;

Yes...Actually, I see that as about 6 times faster, not just "a little".
I will include that version in my List API if I may.
http://www.hpmuseum.org/forum/thread-9411.html

Stephen Lewkowicz (G1CMZ)
https://my.numworks.com/python/steveg1cmz
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Bug? Tricky syntax? Finding items in a list - StephenG1CMZ - 11-04-2017 09:36 AM



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