vle-search


(vle-search  item  lst  asIdx)

searches for 'item' in list 'lst' and returns either the index of 'item' in 'lst' (if 'asIdx' is non-NIL), or the list starting with 'item' (if 'asIdx' is NIL), or NIL if 'item' is not contained in 'lst'

Arguments

'item'   object to search for in 'lst'
'lst'    list of items to search in
'asIdx'  flag defining the type of result :
            if NIL, the list starting with 'item' is returned
            if non-NIL, the index of 'item' in 'lst' is returned

Return

the index of 'item' in 'lst', or the sub-list starting with 'item', depending on 'asIdx' flag;
if 'item' is not contained in 'lst', NIL is returned

Example

(vle-search 11 '(1 2 3 11 22 33 ) nil)   returns   '(11 22 33)
(vle-search 11 '(1 2 3 11 22 33 ) t)      returns   3

Alias


Remarks

returned index is 0-based




©  Bricsys NV. All rights reserved.