7. Recursion II: Lazy Sequences
Activity 7.01: Historical, Player-Centric Elo
Solution:
- Set up your project, which should be based on the code written for the last exercises in this chapter.
- The solution follows the pattern established with
take-matches. Let's start with the parameters. We need to define separate behaviors for matches played by the "focus player" and matches played between other players. The first thing we need is, of course, a way to identify the player, so we'll add aplayer-slugargument. This wasn't necessary intake-matchesbecause there we treated all the matches the same, regardless of who played in them.In
take-matches, we had alimitargument to control how deeply we walked the tree. In this case, we need two different parameters, which we will callfocus-depthandopponent-depth. Together, that gives us the following parameters for our newfocus-historyfunction:(defn focus-history [tree player-slug focus-depth opponent...