It does something similar to the member function. I.e. it finds the first occurrence of an item in the list, then returns the list from that item onwards.
Only in this case it doesn't search by equality, rather it allows you to give it a predicate function. I.e. the difference between vl-remove and vl-remove-if.
This sort of thing is generally used to find a set of values in a list starting at a specific position. E.g. to find the list to vector points in a LWPolyline means you want to find the first item with a 10 as its first sub-item, and all that follow it. E.g.Command: (entget (entlast))
((-1 . <Entity name: 3d9bea7db0>) (0 . "LWPOLYLINE") (330 . <Entity name: 3da35c59f0>) (5 . "273") (100 . "AcDbEntity") (67 . 0) (410 . "Model") (8 . "0") (100 . "AcDbPolyline") (90 . 3) (70 . 0) (43 . 0.0) (38 . 0.0) (39 . 0.0) (10 2248.02 1657.69) (40 . 0.0) (41 . 0.0) (42 . 0.0) (91 . 0) (10 3039.1 2029.71) (40 . 0.0) (41 . 0.0) (42 . 0.0) (91 . 0) (10 3919.75 1712.42) (40 . 0.0) (41 . 0.0) (42 . 0.0) (91 . 0) (210 0.0 0.0 1.0))
I could do this:Command: (setq data (entget (entlast)))
((-1 . <Entity name: 3d9bea7db0>) (0 . "LWPOLYLINE") (330 . <Entity name: 3da35c59f0>) (5 . "273") (100 . "AcDbEntity") (67 . 0) (410 . "Model") (8 . "0") (100 . "AcDbPolyline") (90 . 3) (70 . 0) (43 . 0.0) (38 . 0.0) (39 . 0.0) (10 2248.02 1657.69) (40 . 0.0) (41 . 0.0) (42 . 0.0) (91 . 0) (10 3039.1 2029.71) (40 . 0.0) (41 . 0.0) (42 . 0.0) (91 . 0) (10 3919.75 1712.42) (40 . 0.0) (41 . 0.0) (42 . 0.0) (91 . 0) (210 0.0 0.0 1.0))
Command: (member (assoc 10 data) data)
((10 2248.02 1657.69) (40 . 0.0) (41 . 0.0) (42 . 0.0) (91 . 0) (10 3039.1 2029.71) (40 . 0.0) (41 . 0.0) (42 . 0.0) (91 . 0) (10 3919.75 1712.42) (40 . 0.0) (41 . 0.0) (42 . 0.0) (91 . 0) (210 0.0 0.0 1.0))
But that means it only works on association lists, and it also searches through the list twice (once to find the association item and second to find the exact match). Rather this may be more efficient:
Command: (vl-member-if '(lambda (a) (= (car a) 10)) (entget (entlast)))
((10 2248.02 1657.69) (40 . 0.0) (41 . 0.0) (42 . 0.0) (91 . 0) (10 3039.1 2029.71) (40 . 0.0) (41 . 0.0) (42 . 0.0) (91 . 0) (10 3919.75 1712.42) (40 . 0.0) (41 . 0.0) (42 . 0.0) (91 . 0) (210 0.0 0.0 1.0))
Not to mention, I could have searched on multiple criteria. Say I wanted to find the first vector where the x value is greater than 3000:
Command: (vl-member-if '(lambda (a) (and (= (car a) 10) (> (cadr a) 3000))) (entget (entlast)))
((10 3039.1 2029.71) (40 . 0.0) (41 . 0.0) (42 . 0.0) (91 . 0) (10 3919.75 1712.42) (40 . 0.0) (41 . 0.0) (42 . 0.0) (91 . 0) (210 0.0 0.0 1.0))