F
F
Filipp422021-08-10 01:50:30
Lisp
Filipp42, 2021-08-10 01:50:30

How to do a specific tree traversal in Lisp?

There is a tree representing the school timetable.
Here is an example:

'((128 "A" (("математика"  "Мария Ивановна" 210)
            ("русский"     "Мария Ивановна" 210))
           (("физкультура" "Иван Иванович"  102)
            ("литература"  "Румиль"         210)))

  (256 "А" (("литература"   "Румиль"        211)
            ("физкультура" "Иван Иванович"  102))
           (("математика"  "Мария Ивановна" 211)
            ("русский"     "Мария Ивановна" 211))))

The root list contains lists that store data about the class, first it is a number and a letter, and then there is a list of days. Each day is represented by a list with several more lists (lessons) with the name of the subject, the name of the teacher and the class number.
For all classes, lessons begin on the same day from the first lesson.
I want the function to go through the lesson lists day by day, lesson by lesson, and check if there are any class or teacher matches in the corresponding lesson lists. I probably explained crookedly, so ask clarifying questions.
How convenient is such a data structure, which can be applied with great success.
PS I took the names from the example out of my head and did not seek to offend anyone

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question