vl-member-if
 
 
 

Determines if the predicate is true for one of the list members

(vl-member-if  predicate-functionlist)

The vl-member-if function passes each element in list to the function specified in predicate-function. If predicate-function returns a non-nil value, vl-member-if returns the rest of the list in the same manner as the member function.

Arguments

predicate-function

The test function. This can be any function that accepts a single argument and returns T for any user-specified condition. The predicate-function value can take one of the following forms:

  • A symbol (function name)
  • '(LAMBDA (A1 A2) ...)
  • (FUNCTION (LAMBDA (A1 A2) ...))
list

A list to be tested.

Return Values

A list, starting with the first element that passes the test and containing all elements following this in the original argument. If none of the elements passes the test condition, vl-member-if returns nil.

Examples

The following command draws a line:

_$ (COMMAND "_.LINE" '(0
10) '(30 50) nil)
nil

The following command uses vl-member-if to return association lists describing an entity, if the entity is a line:

_$ (vl-member-if
'(lambda (x) (= (cdr x)
"AcDbLine"))
   (entget (entlast)))
((100 . "AcDbLine") (10 0.0 10.0 0.0) (11 30.0 50.0 0.0) (210 0.0 0.0 1.0)) 
See Also