---
title: Eboard 21  Recursion basics lab
number: 21
section: eboards
held: 2019-03-13
link: true
---
CSC 151 2019S, Class 21:  Recursion basics lab
==============================================

_Overview_

* Preliminaries
    * Notes and news
    * Upcoming work
    * Extra credit
    * Questions
* Quick survey
* Lab
* Debrief

Preliminaries
-------------

### News / Etc.

* Mentor sessions Wednesday 8-9 p.m., Thursday 8-9 p.m., Sunday 5-6 p.m.
    * No mentor session the Sunday at the end of break.
* Today we ground our understanding of recursion in practice.
* Today is Friday the 13th (it falls on a Wednesday this month).  Be
  careful.

### Upcoming work

* Reading for Friday:
  [Helper Recursion](../readings/helper-recursion).
* Epilogue due TONIGHT.
* Cover sheets due NOW.
    * There's blank paper at the back of the room.
    * Your cover sheet is the only place "There's more to life" belongs.
* No flashcards this week!
* Lab writeup: TBD.
* Quiz Friday: Match first names and faces.  Those with multiple
  names will likely see both names appear.
    * If you won't be in class on Friday, talk to me immediately after
      class about when you might take the quiz.

### Extra Credit

_I would certainly appreciate suggestions of other extra credit activities
(preferably via email)._

#### Extra credit (Academic/Artistic)

* Convocation, Thursday at 11 in JRC 101

#### Extra credit (Peer)

* Grinnell Singers, St. Paul Saturday, Rochester Sunday, ...
* Women's Golf, Amelia Island, last Sunday of spring break.
* Track and Field, Emory University, last weekend of spring break.

#### Extra credit (Wellness)

* Sub-free spring break

#### Extra credit (Wellness, Regular)

* 30 Minutes of Mindfulness at SHACS every Monday 4:15-4:45
* Any organized exercise.  (See previous eboards for a list.)
* 60 minutes of some solitary self-care activities that are unrelated to
  academics or work.  Your email reflection must explain how the activity
  contributed to your wellness.
* 60 minutes of some shared self-care activity with friends. Your email
  reflection must explain how the activity contributed to your wellness.

#### Extra credit (Misc)

### Other good things 

### Questions

Quick survey
------------

On a white index card, write your name and one of these three descriptions:

* **Methodical** - You find it best to slowly work through homework
  problems.
* **Zoomer** - You feel like you know the material so well that you
  can (and want to) zoom through problems.
* **In between** - Self descriptive.

I will do my best to partner people with similar classifications.

Lab
---

Some observations about Racket that may be helpful

```drracket
> (sqr 3)
9
> (+)
0
> (*)
1
```

"I'm uncomfortable that the product of the empty list is 1."

> Then stop your recursion when the list length is 1.

Writeup: Exercise 7

Debrief
-------

How to check whether a list has one element ...

* The bad way `(= (length lst) 1)`
* The good way `(and (not (null? lst)) (null? (cdr lst)))`

```drracket
(define largest
  (lambda (lst)
    (cond
      [(singleton? lst) ; has one element, not implemented yet
       (car lst)]
      [(< (car lst) (cadr lst))
       (largest (cdr lst))]
      [else
       (largest (cons (car lst) (cddr lst)))])))
```


