Я пытаюсь решить задачу и пытаюсь преобразовать этот параметр:
(DEFPARAMETER AUSSAGEN '(
(THE OFFICE IS EAST OF THE HALLWAY)
(THE KITCHEN IS NORTH OF THE OFFICE)
(THE GARDEN IS WEST OF THE BEDROOM)
(THE OFFICE IS WEST OF THE GARDEN)
(THE BATHROOM IS NORTH OF THE GARDEN)
(THE BEDROOM IS SOUTH OF THE LAVATORY)
(THE BATHROOM IS WEST OF THE LAVATORY)
(THE KITCHEN IS WEST OF THE BATHROOM)
(THE KITCHEN IS EAST OF THE STUDIO)
(THE HALLWAY IS SOUTH OF THE STUDIO)))
в этот список:
((HALLWAY EAST OFFICE) (OFFICE WEST HALLWAY)
(OFFICE NORTH KITCHEN) (KITCHEN SOUTH OFFICE)
(BEDROOM WEST GARDEN) (GARDEN EAST BEDROOM)
(GARDEN WEST OFFICE) (OFFICE EAST GARDEN)
(GARDEN NORTH BATHROOM) (BATHROOM SOUTH GARDEN)
(LAVATORY SOUTH BEDROOM) (BEDROOM NORTH LAVATORY)
(LAVATORY WEST BATHROOM) (BATHROOM EAST LAVATORY)
(BATHROOM WEST KITCHEN) (KITCHEN EAST BATHROOM)
(STUDIO EAST KITCHEN) (KITCHEN WEST STUDIO)
(STUDIO SOUTH HALLWAY) (HALLWAY NORTH STUDIO))
Это мой код:
(DEFUN WB-GEN (AUSS)
(COND ((NULL AUSS))
(T (LIST (FirstList(REVERSE (CAR AUSS)))(SecondList (CAR AUSS))(WB-GEN (CDR AUSS)))))
)
(Defun FirstList (AUSS)
(LIST (CAR AUSS) (CADDDR AUSS) (CADDR(CDDDR AUSS)))
)
(DEFUN SecondList (AUSS)
(LIST (CADR AUSS) (let ((x(CADDDR AUSS)))(COND
((EQL x 'NORTH)'SOUTH)
((EQL x 'EAST)'WEST)
((EQL x 'SOUTH)'NORTH)
((EQL x 'WEST)'EAST))) (CAR (LAST AUSS)))
Но я не знаю, почему я получаю в результате что-то вроде этого списка (# # #)
Полный результат из моего кода: ((HALLWAY EAST OFFICE) (OFFICE WEST HALLWAY) ((OFFICE NORTH KITCHEN) (KITCHEN SOUTH OFFICE) ((BEDROOM WEST GARDEN) (GARDEN EAST BEDROOM) (# # #))))