University of Virginia, Department of Computer Science
CS200: Computer Science, Spring 2002

Notes: Wednesday 6 February 2002

Null/Nill Confusion

In SICP, they use nil. In MzScheme (DrScheme's language), they use null. The Revised5 Report on the Algorithmic Language Scheme mentions nil but uses the empty list (denoted by '()) instead. As the footnote on page 101 explains, the exact meaning and name for the empty list is cause for lots of dispute and confusion. We will use null in class to be consistent with MzScheme.

Notes - code examples from this lecture

How can we define insertl?

(define (doubleall lst)
  (insertlg (lambda (a b) (cons (* 2 a) b)) lst null))
How could we define insertlg?

    def f ≡ isposint → iszero → g1 ; g2 o [f o dec, g3] ; error
     -›› def f ≡ isposint → (/l:(g2 o [s1, g3 o s2])) o al o [g1 o ~0, intsto] ; error
             FL Rewrite Rule (/l is insertl). (Shown for amusement purposes only.)

CS 655 University of Virginia
Department of Computer Science
CS 200: Computer Science
David Evans
Using these Materials