Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Now change the javadoc Access level in the javadoc Preferences to private and generate javadoc again. What is the difference?

From Scheme To Java

Has the world really changed as we transition from Scheme to Java?  Well, yes and no.   Yes, because we now look at the world as a collection of objects rather than as a collection of funcitons.   No, because CS principles still hold and so the same concepts must be still hold true no matter what language we express them in.

In particular, let's look at what happens to the list template from Scheme:

Code Block
 (define (listFunc aList)
    (cond
       [(empty? aList) ...]
       [(cons? aList) ... (first aList)... (listFunc (rest aList))...])) 

 First, let's review what the template is saying to us:

  • The template is a statement of an invariant properties of lists and the functions that process them.   That is, the template tells us things that are true for all lists.
  • A function on a list is fundamentally separable into two parts:
    • The base case: The empty list is processed separately from the non-empty list.
    • The inductive case: The non-empty list (cons) is processed separately from the empty list and involves the two pieces of the non-empty list, namely first and rest.
  • A recursive algorithm involves processing the rest of the list.

More List Exercises

Recall our object model (common known in the Scheme world as "data definition") for lists of int.

...