(defun combine-list-into-keyword (parents depth-of-combination &key (from-start nil) (ignore-positions '()) (all-parents nil)) "Combines the name of the parents with the parent names upto depth-of-combination, eg the node-name 'charles' with the node-parents being (sex height race name) and depth 2 would would become ':race-name-charles', but 4 would be ':sex-height-race-name-charles', depth is measured from right to left, so most recent parent first. If all-parents is set to t, then all the parents with the exception of the positions listed in ignore-positions will be used" (let* ((nparents (if (listp ignore-positions) (let ((items-to-remove (collect-positions-in-list parents ignore-positions))) (remove-list-items-from-list items-to-remove parents)) parents)) (d-o-p (cond (all-parents (length nparents)) ((< depth-of-combination 1) 1) ((< (length nparents) depth-of-combination) (length nparents)) (t depth-of-combination)))) (intern (format nil "~{~a~^-~}" (if from-start (subseq nparents 0 d-o-p) (reverse (subseq (reverse nparents) 0 d-o-p)))) "KEYWORD")))