Skip to main content

CSC 151.03, Class 20: Other forms of list recursion

Overview

  • Preliminaries
    • Notes and news
    • Upcoming work
    • Extra credit
    • Questions
  • Problem 6 from Friday’s lab
  • DrRacket tips and tricks
  • Reading summary
  • Lab
  • Debrief (?)

News / Etc.

  • I have not received all grades from the graders. I have not finished my own grading for CSC 151. I brought food instead. I should have some grades on Wednesday.
  • “Is it normal to need to ask questions on the exam?” Yes.
  • “I feel like I’m asking a lot.” Some folks ask a lot. Others don’t. Don’t stress.
  • “Can you talk about cool DrRacket tricks?” I’m not sure that any of them are cool, but I’ll go over the ones that come to mind.

Upcoming Work

Extra credit (Academic/Artistic)

  • Aspen Trio on Wednesday at 7:30 p.m.

Extra credit (Peer)

Extra credit (Misc)

Other good things

  • Volleyball vs. U. Dubuque Tuesday at 7:00 p.m.

Questions

What’s the time limit on extra credit?
A few days.
But I have been known to take them a month late.
I wouldn’t recommend pushing your luck. Strive for soon.

Problem 6 from Friday’s lab

(define furthest-from-zero-alt
  (lambda (numbers)
    (display (list 'furthest-from-zero-alt numbers)) (newline)
    (if (null? (cdr numbers))
        (car numbers)
        (if (>= (abs (car numbers)) 
                (abs (furthest-from-zero-alt (cdr numbers))))
            (car numbers)
            (furthest-from-zero-alt (cdr numbers))))))

Solution?

(define furthest-from-zero-alt
  (lambda (numbers)
    (display (list 'furthest-from-zero-alt numbers)) (newline)
    (if (null? (cdr numbers))
        (car numbers)
        (let ([result-from-magic-recursion-fairy
               (furthest-from-zero-alt (cdr numbers))])
          (if (>= (abs (car numbers))
                  (abs result-from-magic-recursion-fairy))
              (car numbers)
              result-from-magic-recursion-fairy)))))

DrRacket tips and tricks

See the handout.

Reading summary

Skipped.

Lab

Writeup: Exercise 4, no documentation.

Debrief

Skipped.