\iffalse

INSTRUCTIONS: (if this is not ps1, use the right file name)

  Clip out the ********* INSERT HERE ********* bits below and insert
appropriate TeX code.  Once you are done with your file, run

  ``latex template.tex''

from the Athena shell.  If your TeX code is clean, the latex will exit
back to a prompt.  Once this is done, run

  ``dvips template.dvi -o template.ps''

which should print your file to the nearest printer.  There will be
residual files called ps1.log, ps1.aux, and ps1.dvi.  All these can be
deleted, but do not delete ps1.tex.

\fi
\documentclass[11pt]{article}
\usepackage{amsfonts}
\usepackage{latexsym}
\usepackage{graphicx}
\setlength{\oddsidemargin}{.25in}
\setlength{\evensidemargin}{.25in}
\setlength{\textwidth}{6in}
\setlength{\topmargin}{-0.4in}
\setlength{\textheight}{8.5in}
\setlength{\parindent}{0pt}
%\setlength{\parskip}{1ex plus 0.5ex minus 0.2ex}

\newcommand{\var}[0]{
  \textrm{var}
}

\newcommand{\E}[0]{
  \mathbf{E}
}

\newcommand{\cov}[0]{
  \textrm{cov}
}

\newcommand{\handout}[5]{
   \renewcommand{\thepage}{\arabic{page}}
   \noindent
   \begin{center}
   \framebox{
      \vbox{
    \hbox to 5.78in { {\bf 6.001 SICP Spring 2004} \hfill #2 }
       \vspace{4mm}
       \hbox to 5.78in { {\Large \hfill #5  \hfill} }
       \vspace{2mm}
       \hbox to 5.78in { {\it #3 \hfill #4} }
      }
   }
   \end{center}
   \vspace*{4mm}
}

\newcommand{\ho}[5]{\handout{#1}{#2}{Instructor:
#3}{Teaching Assistant: #4}{Handout #1: #5}}
\newcommand{\al}{\alpha}
\newcommand{\Z}{\mathbb Z}

\begin{document}
\handout{P1}{2/23/2004}
{} % {Problem Set 4}
{} % {Instructor: foo}
{Tutorial 3} %{Bryan Russell}

\section*{Topics}
Data Abstraction, Higher-Order Procedures

\section*{Upcoming Deadlines}

\begin{itemize}
\item Problem set 3 due Tuesday, 2/24 at midnight
\item Lecture 7 due Wednesday, 2/25 at 9am
\item Lecture 8 due Friday, 2/27 at 9am
\item Project 2 due Friday, 2/27 at 6pm
\end{itemize}

\section*{Data Abstraction and Higher-Order Procedures - Fantasy NCAA hoops}

\begin{verbatim}
(define (make-player name team position)
  (list name team position))

(define (make-stats player points rebounds assists)
  (list player points rebounds assists))

(define (make-fantasy proc-pts proc-rebs proc-asts)
  (lambda (s)
    (+ QUESTION-1 QUESTION-2 QUESTION-3)))

; Accessors

(define player-name QUESTION-4)
(define player-team QUESTION-5)
(define player-position QUESTION-6)

(define get-player QUESTION-7)
(define get-points QUESTION-8)
(define get-rebounds QUESTION-9)
(define get-assists QUESTION-10)

; Create a few players:

(define channing-frye (make-player "Channning Frye" "Arizona" "center"))
(define frye-stats (make-stats channing-frye 18 13 1))

(define salim-stoudamire (make-player "Salim Stoudamire" "Arizona" "guard"))
(define stoudamire-stats (make-stats salim-stoudamire 12 2 3))

(define craig-smith (make-player "Craig Smith" "Boston College" "forward"))
(define smith-stats (make-stats craig-smith 11 6 2))

; Create our fantasy point system:

; Every 5 points is one fantasy point
(define (point-pts points)
  QUESTION-11)

; Every 2 rebounds is one fantasy point
(define (rebound-pts rebounds)
  QUESTION-12)

; Every assist is one fantasy point
(define (assist-pts assists) 
  QUESTION-13)

; Define our fantasy system
(define fantasy
  QUESTION-14)

; Create a fantasy team from a list of players:
(define my-team (list frye-stats stoudamire-stats smith-stats))

; Compute fantasy points for the entire team
(define (team-pts team fantasy)
  QUESTION-16)

; Get all guards on the team
(define (get-guards team)
  QUESTION-17)
\end{verbatim}

\end{document}
