ListFind¶
Find the first (or last) index at which a specific item is found.
The item may also be identified by means of a predicate (function/graph). If the item is not found, return the value specified by the 'notfound' port (default -1). If the list is None, None is propagated out. Version 1.0.0
Ports/Properties¶
lst¶
List to process.
item¶
Item whose index to return.
pred¶
Predicate to use to find the item.
pred__signature¶
Optional name of a placeholder that will receive the list element of which to compute the find predicate. Instead of searching for an item by value, you can specify a predicate function. The predicate, if specified, is a function that returns True if the current item is the one that is being searched, and False otherwise. You can define a predicate function by creating a graph that starts with a Placeholder node whose slotname must be set to the same name as listed here (e.g., "item"), followed by some computation, and whose final node returns True or False. That final node's output is then wired into the "pred" input port of ListFind. In graphical UIs this edge will show as dotted to indicate that this is not normal forward data flow but a subgraph (i.e., the predicate) being passed to the List Find node. The predicate function is then called for each element in the list, and upon encountering an item where the predicate returns True, the search terminates and returns the item in question. If the predicate is not specified, ListFind by default compares with the value in the "item" port. This graph should only involve stateless nodes.
index¶
Index of item in list.
find_last¶
Find the index of the last occurrence instead of the first.
notfound¶
Value to return if the item is not found. This can also be set to None if desired.
set_breakpoint¶
Set a breakpoint on this node. If this is enabled, your debugger (if one is attached) will trigger a breakpoint.
metadata¶
User-definable meta-data associated with the node. Usually reserved for technical purposes.