Post Reply 
Picking Out Elements Using a Logical List
08-12-2015, 10:40 AM
Post: #2
RE: Picking Out Elements Using a Logical List
Nice function ! I was expecting it would be very easy to implement it with the current Prime list functions but I've not found a simple solution without a FOR loop.
So, here is another way to do it:

Code:
EXPORT BOOLLIST(LA,LB)
BEGIN
  LOCAL LC,k;
  LC:={};
  FOR k FROM 0 TO SIZE(LA)-1 DO
    IF LB(k MOD SIZE(LB)+1) THEN 
      LC(0):=LA(k+1); 
    END;
  END;
  RETURN LC;
END;

Note: storing to LC(0) is used to add an element to the list LC.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Picking Out Elements Using a Logical List - Didier Lachieze - 08-12-2015 10:40 AM



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