A functional implementation of Depth-First Search

For the last few weeks I have been learning Racket. Coincidentally, Advent Of Code is back one more year. I decided to try to solve it with Racket, to force myself to learn more about the syntax and, well, use it. In particular, Day 7 is a graph problem. Basically we want to see how many vertices can reach a particular destination. This is straighforward. We can use breadth-first search (BFS) or depth-first search (DFS) on every vertex, and that way we’ll know how many can reach it.
Read more...