Post Reply 
Function or operator to test list membership
01-19-2016, 03:28 PM (This post was last modified: 01-19-2016 03:33 PM by sbergman27.)
Post: #1
Function or operator to test list membership
I'm looking for a quick way to check to see if an integer is an element of a list. Maybe I'm just searching for the wrong terms in the Prime User Guide. But I haven't found a fast way to do it. Is "intersect" my best bet?
Find all posts by this user
Quote this message in a reply
01-19-2016, 03:41 PM (This post was last modified: 01-19-2016 03:41 PM by Didier Lachieze.)
Post: #2
RE: Function or operator to test list membership
You can use:
POS(list, element)

Returns the position of an element within a list. A value of 0 is returned if there is no occurrence of the specified element.

Example:
POS ({3,7,12,19},12) returns 3
Find all posts by this user
Quote this message in a reply
01-22-2016, 04:13 AM
Post: #3
RE: Function or operator to test list membership
Thank you.
Find all posts by this user
Quote this message in a reply
Post Reply 




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