What does the functor do on the tree?
summary
Models a Scala enum tree as Branch/Leaf, implements an ASCII renderer that passes snapshot tests, and finds depth-first rendering fails on column characters so it uses a mutable queue for BFS labeling to record first/middle/last positions and then a recursive DFS to emit prefixes. Implements a Functor as a simple map over the tree to turn events/talks/speakers into strings. The pipeline runs end to end and produces the expected console tree output.
AI-written summary · about
chapters (8)
- 0:00Introduction
- 2:10Project goal and tree visualization
- 6:23Fixing tree drawing with DFS
- 9:10Switching to BFS for nesting
- 11:36Labeling tree nodes for alignment
- 13:43Combining algorithms for any tree
- 16:10Functor to solve the problem
- 18:19Scala: FP and OOP approach
related talks
35mThe Functor, Applicative, Monad talk
22mScale By The Bay 2018 Unconference: Gabriel Claramunt
23mFunctor Zoo
33mFunctional Patterns and Gems in Scala
31mAbstract your representation and fix your functors
01h 32mAlgorithms for Trees - Foldable, Applicative, Traversable
01h 03mIntro to FP in Scala: Exploring a Toolbox for Solving Problems - Part 4 of 6
42mA pragmatic introduction to Category Theory
