Practical Pointers useful for the OOP assignment:

Allowing functions to take multiple arguments. You will want to take advantage of another cool feature of Scheme, namely the ability to define functions that take arbitrary numbers of arguments.  That is, you can define a single function that takes as many arguments as you like. It's simple:  in the function definition, you simply put some variable name where you would normally place the argument list. So instead of writing "(define foo (lambda (args) ....))"  you write "(define foo (lambda arglist ...))".  Here's a quick example:

(define testfn 
  (lambda arglist ;; note no parens around the "arglist" --> all args placed as list into "arglist".
    (display "the list of arguments you passed in is: ")
    (display arglist)))
	
> (testfn 'here 'are 'multiple 'args)
the list of arguments you passed in is: (here are multiple args)

> (testfn 1 2)
the list of arguments you passed in is: (1 2)
>

Controlling evaluation: Quoting and quasiquoting. One of the coolest features of Scheme is the ability for Scheme programs to create/"write" new functions, and then define those on the fly. We have seen this in action in Program 1-Function-maker, and it is a central feature of this assignment, as your program reads class defs and defines new object factories and instances. One of the tricky practical issues in using a program to "write" a new function is controlling evaluation of things in the new program. Here are some functions and facilities in Scheme that will help in this respect. I'll just point you in the right direction and you can consult the manual for further details.

The quote function. Sometimes you want to quote something inside the new function your are consing up, but if you just put in a normal ' mark to quote it, this causes problems or is prematurely "gobbled up" by the evaluator. When using the ' shorthand is impractical, you can simply put in a call to the special quote function, which has the same effect. Thus, (quote foo) has the same effect as 'foo, i.e., quote protects its arguments from evaluation.

Quasiquoting. A super-useful ability when you're consing up a new function definition to be subsequently evaluated is quasiquoting. Quasiquoting is essentially a macro facility: it works just like quoting, except that you may selectively evaluate items in the quoted list. So let's say I have a top-level variable called x defined as 'funky. Here is how quoting compares to quasi-quoting:

So let's see how this is useful. For instance, suppose I have a function-maker that is supposed to create functions that returns a list of two literal names that are passed in as args. So my maker function looks something like:

>(define foo (fn-maker 'hep 'ho))  
  >(foo)
  >(hep ho)
 
Ok, so that's what I want as output.  Thus, I write my fn-maker as follows:
  (define fn-maker
  (lambda (name1 name2)
  (eval (list 'lambda '() (list 'list name1 name2) ))))
  
 But when I eval fn-maker and run this I get:
  >(define foo (fn-maker 'hep 'ho))
  >(foo)
  reference to undefined identifier: hep
  
 Dang!  Well, if I look at the code that fn-maker is producing BEFORE being eval'd into a fn, I see:
  (lambda () (list hep ho))
  
 Aha!  I see:  so when this is eval'd and run, it tries to eval hep -- which isn't defined.  I don't WANT to eval
  hep!  I want it literally.  So I modify my code to be:
  (define fn-maker
  (lambda (name1 name2)
  (eval (list 'lambda '() (list 'list 'name1 'name2) ))))
  
 Has to work, right?  I'm quoting the names to protect them. But when I run it in same way as above I now get
  >reference to undefined identifier: name1
  
 So I look at the code produced before the eval step:
  (lambda () (list name1 name2))
  
 Rats!  It protected the names alright! But now (a) I don't even get the args plugged in and (b) it now fails
  when trying to eval the literal arg name name1.  I made it worse!  But wait!  I have my quote function.  So I try:
  (define fn-maker
  (lambda (name1 name2)
  (eval (list 'lambda '() (list (quote name1) (quote name2) )))))
  
Yeah!  That should do it!  But no!  When I run it I get:
  reference to undefined identifier: name1
  
Not again! Looking at the code generated before the eval shows me:
  (lambda () (name1 name2))
  
Dang! Same thing as when I just used apostrophe to quote them!  The problem here is that there are TWO evaluation phases:
one when the function-maker is defined, and a second when the new function is run. 
What I need is to make sure the quotes stay around until the second phase, so that they can protect the names 
from evaluation --- but I want evaluation in the first phase so that the args passed in actually get 
plugged in for name1 and name2.

So I use quasiquoting PLUS the quote function to create the perfect:
  (define fn-maker
  (lambda (name1 name2)
  (eval (list 'lambda '() `(list (quote ,name1) (quote ,name2) )))))
  
and when I run that I get:
  >(define foo (fn-maker 'hep 'ho))
  >(foo)
  >(hep ho)
  
Tada!  See how it worked?  When you ran fn-maker and it eval'd the body, the thing it built up just before the 
eval step was:
  (lambda () (list (quote hep) (quote ho)))
  
which effectively makes the body of the new function look like:
  
  (lambda () (list 'hep 'ho))
  
Which is exactly right!
  

  
In short, you can accomplish about any evaluation control you want by cleverly combining quasiquoting and the quote function.