Method code for $list.locate()

[Turn on line numbering]
arg list, value;
var idx;

return filter idx in [1 .. listlen(list)] where (value == list[idx]);

// Find the index in the list where the value of the element is the value being searched for.  Filter out the zeros so that only valid indices are returned.
// [1, 2, 3, 4].locate(5) -> []
// [4, 2, 3, 4].locate(4) -> [1, 4]

// Created 27-Mar-1995 as a part of ColdCore, see: @help Credit

Tlon