(defun find-attr (node attr)
(let ((children (pt-children node)))
(if (null children)
nil
(let ((subchildren (mapcar ##############
(get-value-if-attrib-present (node attrib) ...)
pt is a class. (pt-children node) yields children of node which are also pt objects. attr is a string. suppossing I write get-value-if-attrib-present to return the value of a pt object if it has the matching attr, how do i go about getting the list of all the values of subchildren of node with matching attr here (at ####….)?
For Common Lisp use one of these functions:
REMOVE-IFREMOVE-IF-NOTREMOVEThey go over a list and remove items. Keep those which you want.
Other wise
LOOPwill do it:ITis aLOOPfeature -> it refers to the value returned by the predicate in theWHENclause.