Name: Anonymous 2012-01-30 20:27
I have a complex list of lists and want something to check the second element of every list of the list in the loop, any supported features like this?
(defun lispify-relations (relation-list)
(mapcar #'(lambda (x)
(destructuring-bind (first relation . rest) x
`(,relation ,first ,@rest)))
relation-list))
CL-USER> (lispify-relations '((parts lintel post1 post2)
(lintel must-be-supported-by post1)
(lintel must-be-supported-by post2)
(lintel a-kind-of wedge)
(post1 a-kind-of brick)
(post1 must-not-touch post2)
(post2 must-not-touch post1)))
((LINTEL PARTS POST1 POST2) (MUST-BE-SUPPORTED-BY LINTEL POST1)
(MUST-BE-SUPPORTED-BY LINTEL POST2) (A-KIND-OF LINTEL WEDGE)
(A-KIND-OF POST1 BRICK) (MUST-NOT-TOUCH POST1 POST2)
(MUST-NOT-TOUCH POST2 POST1))