@extends('template')
@section('title')
Lab 13: Fruitful Recursion
@stop
@section('content')
{{--# Lab 13: Fruitful Recursion
--}}
{{--## [Solutions](/content/labs/lab13/solutions)
--}}
## Summary
+ Part 0: Fruitful Recursion Worksheet
+ Part 1: Fruitful Recursion Warm up
{{--+ Part 2: Recursive File Traversal
--}}
+ Part 2: Fruitful Turtle Recursion
+ Part 3: More Fruitful Turtle Recursion
@include('/labs/_setup', ['folder' => 'lab13'])
@include('/labs/lab13/_toc')
## Big Questions {.bigqs}
- **In a fruitful recursive function, which function frames contribute to the
value returned by the original function frame?**
Show Answer
The answer here is "all of them." Although only the original function frame
directly returns the result value, it will typically use information
returned by other function frames to construct that value, so all of the
function frames end up contributing to the eventual result somehow.
- **Why is it difficult to construct an iterative function that deals with
files in an arbitrary directory structure?**
Show Answer
Because each directory can contain other directories and/or files, the
structure of a directory is a branching structure that's similar to a tree,
rather than a linear structure. Because of this, there is no obvious single
dimension (or even two dimensions) along which to iterate: as you go deeper
into the directory tree, you may find more and more files (or you might
not). A recursive solution tends to be more natural for these kinds of
problems: because the structure of the file tree itself is recursive:
directories contain other directories, which may contain other directories,
and so on.
@stop