diff options
Diffstat (limited to 'js/games/nluqo.github.io/~bh/ssch27')
-rw-r--r-- | js/games/nluqo.github.io/~bh/ssch27/appendix-cl.html | 523 | ||||
-rw-r--r-- | js/games/nluqo.github.io/~bh/ssch27/appendix-funlist | 170 | ||||
-rw-r--r-- | js/games/nluqo.github.io/~bh/ssch27/appendix-funlist.html | 182 | ||||
-rw-r--r-- | js/games/nluqo.github.io/~bh/ssch27/appendix-gpl.html | 403 | ||||
-rw-r--r-- | js/games/nluqo.github.io/~bh/ssch27/appendix-running.html | 426 | ||||
-rw-r--r-- | js/games/nluqo.github.io/~bh/ssch27/appendix-simply | 14 | ||||
-rw-r--r-- | js/games/nluqo.github.io/~bh/ssch27/appendix-simply.html | 965 | ||||
-rw-r--r-- | js/games/nluqo.github.io/~bh/ssch27/appindex.html | 360 | ||||
-rw-r--r-- | js/games/nluqo.github.io/~bh/ssch27/appuindex.html | 474 | ||||
-rw-r--r-- | js/games/nluqo.github.io/~bh/ssch27/category.html | 161 | ||||
-rw-r--r-- | js/games/nluqo.github.io/~bh/ssch27/credits | 78 | ||||
-rw-r--r-- | js/games/nluqo.github.io/~bh/ssch27/credits.html | 117 | ||||
-rw-r--r-- | js/games/nluqo.github.io/~bh/ssch27/glossary.html | 433 |
13 files changed, 4306 insertions, 0 deletions
diff --git a/js/games/nluqo.github.io/~bh/ssch27/appendix-cl.html b/js/games/nluqo.github.io/~bh/ssch27/appendix-cl.html new file mode 100644 index 0000000..f4dc775 --- /dev/null +++ b/js/games/nluqo.github.io/~bh/ssch27/appendix-cl.html @@ -0,0 +1,523 @@ +<P> + +<P> +<HTML> +<HEAD> +<TITLE>Simply Scheme Appendix B: Common Lisp</TITLE> +</HEAD> +<BODY> +<CITE>Simply Scheme</CITE>: +<CITE>Introducing Computer Science</CITE> 2/e Copyright (C) 1999 MIT +<H2>Appendix B</H2> +<H1>Common Lisp</H1> + +<TABLE width="100%"><TR><TD> +<IMG SRC="../simply.jpg" ALT="cover photo"> +<TD><TABLE> +<TR><TD align="right"><CITE><A HREF="http://www.cs.berkeley.edu/~bh/">Brian +Harvey</A><BR>University of California, Berkeley</CITE> +<TR><TD align="right"><CITE><A HREF="http://ccrma.stanford.edu/~matt">Matthew +Wright</A><BR>University of California, Santa Barbara</CITE> +<TR><TD align="right"><BR> +<TR><TD align="right"><A HREF="../pdf/ssch27.pdf">Download PDF version</A> +<TR><TD align="right"><A HREF="../ss-toc2.html">Back to Table of Contents</A> +<TR><TD align="right"><A HREF="appendix-running.html"><STRONG>BACK</STRONG></A> +chapter thread <A HREF="appendix-simply.html"><STRONG>NEXT</STRONG></A> +<TR><TD align="right"><A HREF="http://mitpress.mit.edu/0262082810">MIT +Press web page for <CITE>Simply Scheme</CITE></A> +</TABLE></TABLE> + +<HR> + +<P>The two most popular dialects of Lisp are Scheme and Common Lisp. This +appendix, which assumes that you have finished the rest of this book, +describes the most important differences between Scheme and Common Lisp so +that you will be able to use Common Lisp if you need to. Common Lisp is the +most popular language among Artificial Intelligence researchers, so AI +courses often use Common Lisp. + +<P><H2>Why Common Lisp Exists</H2> + +<P>Since the beginning of Lisp, many versions of the language were developed. +Each dialect reflected different ideas about the most important capabilities +to include in the language. This diversity made Lisp an exciting arena for +research, but it also meant that a Lisp program written for one dialect +couldn't be used elsewhere. + +<P>In 1984, a group of Lisp developers decided to define a version of Lisp that +would combine the capabilities of all their favorite dialects, so that in +the future they would all use the same language; thus the name "Common" +Lisp. Common Lisp was not the first attempt at a universal Lisp dialect, +but it was more successful than earlier efforts. In 1985 a revision of the +language was begun under the aegis of ANSI, the American National Standards +Institute. This ANSI sponsorship gave Common Lisp an official status that +has contributed to its growing acceptance. + +<P>Since Common Lisp was designed by combining the capabilities of many earlier +dialects, it's an enormous language with nearly 1000 primitives, including +versions of several programs in this book. There is a primitive <CODE>sort</CODE> +procedure, a procedure like <CODE>number-name</CODE> that spells numbers in +English, and a <CODE>substitute</CODE> procedure identical to the one you wrote in +an exercise, to name a few. + +<P>If you're writing your own programs in Common Lisp, you can ignore all the +extra features and just use the capabilities you already know from Scheme. +If you're trying to read someone else's Common Lisp program, we expect that +you will have to look up many primitive procedures in a reference manual. + +<P><H2>Defining Procedures and Variables</H2> + +<P>One minor difference between Scheme and Common Lisp is in the way procedures +are defined. In Common Lisp, + +<P><PRE>(defun square (x) + (* x x)) +</PRE> + +<P>means the same as Scheme's + +<P><PRE>(define (square x) + (* x x)) +</PRE> + +<P>In Scheme, <CODE>define</CODE> is used both for procedures and for variables whose +values aren't procedures. In Common Lisp, procedures are given names by a +mechanism separate from the general variable mechanism; <CODE>defun</CODE> is only +for procedures. To define a variable, use <CODE>defvar</CODE>: + +<P><PRE>common-lisp> (defvar x 6) +6 + +common-lisp> x +6 +</PRE> + +<P>In Common Lisp, <CODE>defvar</CODE> returns the name of the variable you +define. If a variable has already been defined, <CODE>defvar</CODE> will not +change its value; for that you must use <CODE>setq</CODE>. + +<P><H2>The Naming Convention for Predicates</H2> + +<P>In Common Lisp, names of predicate procedures end in a "<CODE>p</CODE>" (for +"predicate") instead of a question mark. Unfortunately, this convention +isn't followed strictly. For example, Common Lisp's version of the <CODE>null?</CODE> predicate is just "<CODE>null</CODE>," not "<CODE>nullp</CODE>." + +<P><H2>No Words or Sentences</H2> + +<P>We've mentioned that Scheme doesn't really have words and +sentences built in; neither does Common Lisp. So none of the following +procedures have Common Lisp equivalents: <CODE>accumulate</CODE>, <CODE>appearances</CODE>, <CODE>before?</CODE>, <CODE>bf</CODE>, <CODE>bl</CODE>, <CODE>butfirst</CODE>, <CODE>butlast</CODE>, <CODE>count</CODE>, <CODE>empty?</CODE>, <CODE>every</CODE>, <CODE>first</CODE>, <CODE>item</CODE>, +<CODE>keep</CODE>, <CODE>last</CODE>, <CODE>member?</CODE>, <CODE>se</CODE>, <CODE>sentence</CODE>, <CODE>word</CODE>, +and <CODE>word?</CODE>. (Common Lisp does have lists, though, and list-related +procedures such as <CODE>map</CODE>, <CODE>reduce</CODE>, <CODE>append</CODE>, and so on <EM>do</EM> +have equivalents.) + +<P><H2>True and False</H2> + +<P>Common Lisp doesn't have the Boolean values <CODE>#t</CODE> and <CODE>#f</CODE>. +Instead, it has a single false value, <CODE>nil</CODE>, which is also the empty +list. + +<P><PRE>common-lisp> (= 2 3) +NIL + +common-lisp> (cdr '(one-word-list)) +NIL + +common-lisp> '() +NIL +</PRE> + +<P><CODE>Nil</CODE> is a strange beast in Common Lisp. It isn't a variable with the +empty list as its value; it's a special self-evaluating symbol. There is +also <CODE>t</CODE>, a self-evaluating symbol with a true value. + +<P><PRE>common-lisp> 'nil +NIL + +common-lisp> nil +NIL + +common-lisp> t +T +</PRE> + +<P>Like Scheme, Common Lisp treats every non-false (i.e., non-<CODE>nil</CODE>) value +as true. But be careful; in Common Lisp + +<P><PRE>common-lisp> (if (cdr '(one-word-list)) 'yes 'no) +</PRE> + +<P>has the value <CODE>NO</CODE>, because the empty list is <CODE>nil</CODE>. + +<P>In Common Lisp's <CODE>cond</CODE>, there is no equivalent to <CODE>else</CODE>; Common +Lisp programmers instead use <CODE>t</CODE> as the condition for their last clause, +like this: + +<P><PRE>(defun sign (n) + (cond ((> n 0) 'positive) + ((= n 0) 'zero) + (t 'negative))) +</PRE> + +<P><H2>Files</H2> + +<P>Common Lisp's mechanism for dealing with files is trivially different from +Scheme's. What Scheme calls "ports," Common Lisp calls "streams." Also, +there is only one procedure for opening streams; the direction is specified +this way: + +<P><PRE>common-lisp> (defvar out-stream (open "outfile" :direction :output)) +#<OUTPUT STREAM "outfile"> + +common-lisp> (close out-stream) +T + +common-lisp> (defvar in-stream (open "infile" :direction :input)) +#<INPUT STREAM "infile"> + +common-lisp> (close in-stream) +T +</PRE> + +<P>Note that the <CODE>close</CODE> procedure closes both input streams and +output streams. + +<P>To <CODE>read</CODE> from an input stream, you must invoke <CODE>read</CODE> with three +arguments: + +<P><PRE>common-lisp> (read stream nil <EM>anything</EM>) +</PRE> + +<P>The <CODE>nil</CODE> indicates that reaching the end of the file should +not be an error. If <CODE>read</CODE> does reach the end of the file, instead of +returning a special end-of-file object it returns its third argument. +It's possible to choose any value as the indicator for reaching the end +of the file: + +<P><PRE>(let ((next (read stream nil 'xyzzy))) + (if (equalp next 'xyzzy) + 'done + (do-something next))) +</PRE> + +<P>It's important to choose an end-of-file indicator that couldn't +otherwise appear as a value in the file. + +<P><H2>Arrays</H2> + +<P>In Common Lisp, vectors are just a special case of the multidimensional <EM>array</EM> data type that you invented in Exercise <A HREF="../ssch23/vectors.html#arrays">23.15</A>. There are quite a +few differences between Common Lisp arrays and Scheme vectors, none very +difficult, but too numerous to describe here. If you need to use arrays, +read about them in a Common Lisp book. + +<P><H2>Equivalents to Scheme Primitives</H2> + +<P>Other than the word and sentence procedures, here is a table of the +Scheme primitives from the table on page <A HREF="appendix-funlist.html#funlist">funlist</A> that have +different names, slightly different behavior, or do not exist at all +in Common Lisp. Scheme procedures not in this list (other than the +word and sentence ones) can be used identically in Common Lisp. + +<P> +<P><TABLE> +<TR><TH>Scheme<TH>Common Lisp +<TR><TD><CODE>align</CODE> +<TD>Common Lisp's <CODE>format</CODE> primitive has a similar purpose +<TR><TD><CODE>begin</CODE> +<TD><CODE>progn</CODE> +<TR><TD><CODE>boolean?</CODE> +<TD>Doesn't exist; see the section in this appendix about true and +false values. +<TR><TD><CODE>c...r</CODE> +<TD>The same, but <CODE>(c...r nil)</CODE> is <CODE>nil</CODE> instead +of an error. +<TR><TD><CODE>children</CODE> +<TD>You can use our version from Chapter 18. +<TR><TD><CODE>close-...-port</CODE> +<TD><CODE>close</CODE> +<TR><TD><CODE>close-all-ports</CODE> +<TD>Doesn't exist. +<TR><TD><CODE>cond</CODE> +<TD>The same, except for <CODE>else</CODE>; use <CODE>t</CODE> instead. +<TR><TD><CODE>datum</CODE> +<TD>You can use our version from Chapter 18. +<TR><TD><CODE>define</CODE> +<TD>Either <CODE>defun</CODE>, for procedure, or +<CODE>defvar</CODE>, otherwise. +<TR><TD><CODE>display</CODE> +<TD><CODE>princ</CODE> +<TR><TD><CODE>eof-object?</CODE> +<TD>See the section on files. +<TR><TD><CODE>equal?</CODE> +<TD><CODE>equalp</CODE> +<TR><TD><CODE>even?</CODE> +<TD><CODE>evenp</CODE> +<TR><TD><CODE>filter</CODE> +<TD><CODE>remove-if-not</CODE> +<TR><TD><CODE>for-each</CODE> +<TD><CODE>mapc</CODE> +<TR><TD><CODE>integer?</CODE> +<TD><CODE>integerp</CODE> +<TR><TD><CODE>lambda</CODE> +<TD>Discussed later in this appendix. +<TR><TD><CODE>list?</CODE> +<TD><CODE>listp</CODE>, except that <CODE>listp</CODE> also returns true +for improper lists. +<TR><TD><CODE>list-ref</CODE> +<TD><CODE>nth</CODE>, except that the arguments come in reverse order. +<TR><TD><CODE>list->vector</CODE> +<TD>See the section about arrays. +<TR><TD><CODE>make-node</CODE> +<TD>You can use our version from Chapter 18. +<TR><TD><CODE>make-vector</CODE> +<TD>See the section about arrays. +<TR><TD><CODE>map</CODE> +<TD><CODE>mapcar</CODE> +<TR><TD><CODE>newline</CODE> +<TD><CODE>terpri</CODE> +<TR><TD><CODE>null?</CODE> +<TD><CODE>null</CODE> +<TR><TD><CODE>number?</CODE> +<TD><CODE>numberp</CODE> +<TR><TD><CODE>odd?</CODE> +<TD><CODE>oddp</CODE> +<TR><TD><CODE>open-...-file</CODE> +<TD>See the section on files. +<TR><TD><CODE>procedure?</CODE> +<TD><CODE>functionp</CODE> +<TR><TD><CODE>quotient</CODE> +<TD><CODE>truncate</CODE> +<TR><TD><CODE>read</CODE> +<TD>Identical except for end of file. See the section on files. +<TR><TD><CODE>read-line</CODE> +<TD>Doesn't exist. (Common Lisp's <CODE>read-line</CODE> is like our +<CODE>read-string</CODE>.) +<TR><TD><CODE>read-string</CODE> +<TD><CODE>read-line</CODE> +<TR><TD><CODE>reduce</CODE> +<TD>The same, but computes <CODE>(f (f a b) c)</CODE> instead of +<CODE>(f a (f b c))</CODE> +<TR><TD><CODE>remainder</CODE> +<TD><CODE>rem</CODE> +<TR><TD><CODE>repeated</CODE> +<TD>Doesn't exist. +<TR><TD><CODE>show</CODE> +<TD><CODE>Doesn't exist but easy to write.</CODE> +<TR><TD><CODE>show-line</CODE> +<TD><CODE>Doesn't exist.</CODE> +<TR><TD><CODE>vector-</CODE><I>anything</I> +<TD>See the section about arrays. +<TR><TD><CODE>write</CODE> +<TD><CODE>prin1</CODE> +</TABLE><P> + + +<P><H2>A Separate Name Space for Procedures</H2> + +<P>All of the differences noted in this table are fairly minor ones, in the +sense that the translation needed to account for these differences requires +little more than renaming. There is one major conceptual difference between +the two languages, however, in the way they treat names of procedures. +Common Lisp allows a procedure and a variable to have the same name. For +example, the program + +<P><PRE>(defun three-copies (list) + (list list list list)) +</PRE> + +<P>is perfectly legal. + +<P><PRE>common-lisp> (three-copies '(drive my car)) +((DRIVE MY CAR) (DRIVE MY CAR) (DRIVE MY CAR)) +</PRE> + +<P>How can Common Lisp tell that one of the <CODE>list</CODE>s means the primitive +procedure, but the other ones mean the formal parameter? Symbols in the +first position in a list (right after an open parenthesis) are taken +to be names of globally defined procedures. + +<P>In Chapter 7 we introduced the image of a blackboard with all the +global variables written on it, which all the Scheme little people can see. +In Common Lisp, there are <EM>two</EM> blackboards: one for global +variables, just as in Scheme, and another one for procedures. The procedure +blackboard contains the primitive procedures and the procedures you define +with <CODE>defun</CODE>. Names in the first position of an expression are looked +up on the procedure blackboard. + +<P>Therefore, the names of procedures are not variables and cannot be used as +actual argument expressions: + +<P><PRE>common-lisp> (sqrt 144) +12 + +common-lisp> (mapcar sqrt '(9 16 25 36)) +ERROR: The variable SQRT is unbound. +</PRE> + +<P>(Common Lisp's equivalent of <CODE>map</CODE> is named <CODE>mapcar</CODE>.) + +<P>How, then, do you tell Common Lisp that you want to use the procedure named +<CODE>sqrt</CODE> as data? You must use the <CODE>function</CODE> special +form.<A NAME="text1" HREF="appendix-cl.html#ft1">[1]</A> + +<P><PRE>common-lisp> (function sqrt) +#<PROCEDURE> + +common-lisp> (mapcar (function sqrt) '(9 16 25 36)) +(3 4 5 6) +</PRE> + +<P><CODE>Function</CODE>'s job is to look up names on the procedure +blackboard. (<CODE>Function</CODE> actually has a more general definition, as +you'll see in a few paragraphs.) + +<P><H2><CODE><B>Lambda</B></CODE></H2> + +<P>In Common Lisp, as in Scheme, procedures can be named or unnamed. Just as +procedure names in Common Lisp are meaningful only in certain contexts, so +are <CODE>lambda</CODE> expressions. They make sense at the beginning of an +expression: + +<P><PRE>common-lisp> ((lambda (x) (* x x)) 4) +16 +</PRE> + +<P>or as the argument to <CODE>function</CODE>: + +<P><PRE>common-lisp> (function (lambda (x) (* x x))) +#<PROCEDURE> + +common-lisp> (mapcar (function (lambda (x) (* x x))) '(3 4 5 6)) +(9 16 25 36) +</PRE> + +<P>but they're meaningless on their own: + +<P><PRE>common-lisp> (lambda (x) (* x x)) +ERROR: LAMBDA is not a function + +common-lisp> (mapcar (lambda (x) (* x x)) '(3 4 5 6)) +ERROR: LAMBDA is not a function +</PRE> + +<P><H2>More about <CODE><B>Function</B></CODE></H2> + +<P>The official rule is that <CODE>function</CODE> returns the "functional +interpretation" of its argument. If the argument is a symbol, that means +looking up the procedure associated with that name. If the argument is a +<CODE>lambda</CODE> expression, it means creating a new procedure. <CODE>Function</CODE> +uses the same rule that's used to interpret the first element of a procedure +invocation. + +<P>Since <CODE>function</CODE> is a very commonly used special form, it has an +abbreviation: + +<P><PRE>common-lisp> (mapcar #'(lambda (x) (* x x)) '(3 4 5 6)) +(9 16 25 36) + +common-lisp> (mapcar #'cdr '((hey jude) (eleanor rigby) (yes it is))) +((JUDE) (RIGBY) (IT IS)) +</PRE> + +<P>Don't confuse + +<P><PRE>#'(lambda (x) (* x x)) +</PRE> + +<P>with + +<P><PRE>'#(lambda (x) (* x x)) +</PRE> + +<P>The first of these is a function that squares its argument; the +second is an array containing three elements. + +<P>It's unfortunate that the abbreviation for <CODE>function</CODE> contains a single +quote mark, because the job of <CODE>function</CODE> is nothing like the job of +<CODE>quote</CODE>. You'll just have to get used to the "hashquote" notation. + +<P><H2>Writing Higher-Order Procedures</H2> + +<P>Think about this attempted translation of the <CODE>map</CODE> procedure: + +<P><PRE>(defun map (fn lst) ;; wrong! + (if (null lst) + '() + (cons (fn (car lst)) + (map fn (cdr lst))))) +</PRE> + +<P>(In Common Lisp, <CODE>null</CODE> is one of the predicates whose names +don't end in "p." Otherwise, this is the same program we showed you in +Chapter 19, except for the <CODE>defun</CODE>, of course.) + +<P>According to our rule about names in the front of a list, this procedure +doesn't work. Think about what happens when we say + +<P><PRE>(map #'square '(1 2 3 4 5)) +</PRE> + +<P>According to the substitution model, the parameters <CODE>fn</CODE> and +<CODE>lst</CODE> are replaced in the body with <CODE>#'square</CODE> and <CODE>'(1 2 3 4 5)</CODE>. But Common Lisp makes an exception for the first +element of a compound expression. It uses the procedure blackboard instead +of substitution: + +<P><PRE>(if (null '(1 2 3 4 5)) + '() + (cons (fn (car '(1 2 3 4 5)) + (map #'square (cdr '(1 2 3 4 5)))))) +</PRE> + +<P>Note that one of the appearances of <CODE>fn</CODE> was left unchanged. +Since there is no global procedure named <CODE>fn</CODE>, this program will produce +an error: + +<P><PRE>common-lisp> (map #'square '(1 2 3 4 5)) +ERROR: FN is not a procedure. +</PRE> + +<P>How, then, do you write higher-order procedures in Common Lisp? The answer is +that you must use <CODE>funcall</CODE>: + +<P><PRE>(defun map (fn lst) + (if (null lst) + '() + (cons (funcall fn (car lst)) + (map fn (cdr lst))))) +</PRE> + +<P><CODE>Funcall</CODE> takes one or more arguments. The first is a +procedure and the rest are arguments for that procedure. It applies that +procedure to the given arguments.<A NAME="text2" HREF="appendix-cl.html#ft2">[2]</A> Since <CODE>fn</CODE> is no longer +at the beginning of a compound expression, the corresponding argument, +<CODE>#'square</CODE>, is substituted for it. + +<P> +<HR> +<A NAME="ft1" HREF="appendix-cl.html#text1">[1]</A> Common Lisp uses the word "function" to mean "procedure," +whether or not the procedure implements a function.<P> +<A NAME="ft2" HREF="appendix-cl.html#text2">[2]</A> This is a lot like <CODE>apply</CODE>, +you may have noticed. Look at the difference: + +<P><PRE>common-lisp> (funcall #'+ 1 2 3) +6 + +common-lisp> (apply #'+ '(1 2 3)) +6 +</PRE> + +<P>In the first case, each argument to <CODE>+</CODE> is a separate argument to <CODE>funcall</CODE>. In the second case, a list of the arguments to <CODE>+</CODE> is a +single argument to <CODE>apply</CODE>. <CODE>Apply</CODE> always takes exactly two +arguments, the procedure and the argument list.<P> +<P><A HREF="../ss-toc2.html">(back to Table of Contents)</A><P> +<A HREF="appendix-running.html"><STRONG>BACK</STRONG></A> +chapter thread <A HREF="appendix-simply.html"><STRONG>NEXT</STRONG></A> + +<P> +<ADDRESS> +<A HREF="../index.html">Brian Harvey</A>, +<CODE>bh@cs.berkeley.edu</CODE> +</ADDRESS> +</BODY> +</HTML> diff --git a/js/games/nluqo.github.io/~bh/ssch27/appendix-funlist b/js/games/nluqo.github.io/~bh/ssch27/appendix-funlist new file mode 100644 index 0000000..de57179 --- /dev/null +++ b/js/games/nluqo.github.io/~bh/ssch27/appendix-funlist @@ -0,0 +1,170 @@ +\input bkmacs +\setpart{\null} +\aprojchap{Alphabetical Table of Scheme Primitives} +\setpart{Alphabetical Table of Scheme Primitives} +\pagetag{\funlist} + +{\leftskip=0pt +This table does not represent the complete Scheme language. It includes the +nonstandard Scheme primitives that we use in this book, and it omits many +standard ones that are not needed here. + +} + +\justtt{*} +\justtt{+} +\justtt{-} +\justtt{/} +\justtt{ceiling} +\justtt{cos} +\justtt{error} +\justtt{even?} +\justtt{expt} +\justtt{floor} +\justtt{integer?} +\justtt{load} +\justtt{log} +\justtt{max} +\justtt{min} +\justtt{odd?} +\justtt{procedure?} +\justtt{quotient} +\justtt{random} +\justtt{remainder} +\justtt{round} +\justtt{sin} +\justtt{sqrt} +\htstart +<TABLE> +<TR><TD><CODE>'</CODE> +<TD>Abbreviation for <CODE>(quote</CODE> …<CODE>)</CODE>. +<TR><TD><CODE>*</CODE><TD>Multiply numbers. +<TR><TD><CODE>+</CODE><TD>Add numbers. +<TR><TD><CODE>-</CODE><TD>Subtract numbers. +<TR><TD><CODE>/</CODE><TD>Divide numbers. +<TR><TD><CODE><</CODE><TD>Is the first argument less than the second? +<TR><TD><CODE><=</CODE><TD>Is the first argument less than or equal to the second? +<TR><TD><CODE>=</CODE><TD>Are two numbers equal? (Like <CODE>equal?</CODE> but works only for numbers). +<TR><TD><CODE>></CODE><TD>Is the first argument greater than the second? +<TR><TD><CODE>>=</CODE><TD>Is the first argument greater than or equal to the second? +<TR><TD><CODE>abs</CODE><TD>Return the absolute value of the argument. +<TR><TD><CODE>accumulate</CODE><TD>Apply a combining function to all elements +(see <A HREF="../ssch8/higher.html#accum">here</A>). +<TR><TD><CODE>align</CODE><TD>Return a string spaced to a given width (see <A +HREF="../ssch20/io.html#spformat">here</A>). +<TR><TD><CODE>and</CODE><TD>(Special form) Are all of the arguments true values (i.e., not <CODE>#f</CODE>)? +<TR><TD><CODE>appearances</CODE><TD>Return the number of times the first argument is in the second. +<TR><TD><CODE>append</CODE><TD>Return a list containing the elements of the argument lists. +<TR><TD><CODE>apply</CODE><TD>Apply a function to the arguments in a list. +<TR><TD><CODE>assoc</CODE><TD>Return association list entry matching key. +<TR><TD><CODE>before?</CODE><TD>Does the first argument come alphabetically before the second? +<TR><TD><CODE>begin</CODE><TD>(Special form) Carry out a sequence of +instructions (see <A HREF="../ssch20/io.html#beg">here</A>). +<TR><TD><CODE>bf</CODE><TD>Abbreviation for <CODE>butfirst</CODE>. +<TR><TD><CODE>bl</CODE><TD>Abbreviation for <CODE>butlast</CODE>. +<TR><TD><CODE>boolean?</CODE><TD>Return true if the argument is <CODE>#t</CODE> or <CODE>#f</CODE>. +<TR><TD><CODE>butfirst</CODE><TD>Return all but the first letter of a word, or word of a sentence. +<TR><TD><CODE>butlast</CODE><TD>Return all but the last letter of a word, or word of a sentence. +<TR><TD><CODE>c...r</CODE><TD>Combinations of <CODE>car</CODE> and +<CODE>cdr</CODE> (see <A HREF="../ssch17/lists.html#cadr">here</A>). +<TR><TD><CODE>car</CODE><TD>Return the first element of a list. +<TR><TD><CODE>cdr</CODE><TD>Return all but the first element of a list. +<TR><TD><CODE>ceiling</CODE><TD>Round a number up to the nearest integer. +<TR><TD><CODE>children</CODE><TD>Return a list of the children of a tree node. +<TR><TD><CODE>close-all-ports</CODE><TD>Close all open input and output ports. +<TR><TD><CODE>close-input-port</CODE><TD>Close an input port. +<TR><TD><CODE>close-output-port</CODE><TD>Close an output port. +<TR><TD><CODE>cond</CODE><TD>(Special form) Choose among several alternatives +(see <A HREF="../ssch6/true.html#cond">here</A>). +<TR><TD><CODE>cons</CODE><TD>Prepend an element to a list. +<TR><TD><CODE>cos</CODE><TD>Return the cosine of a number (from trigonometry). +<TR><TD><CODE>count</CODE><TD>Return the number of letters in a word or number of words in a sentence. +<TR><TD><CODE>datum</CODE><TD>Return the datum of a tree node. +<TR><TD><CODE>define</CODE><TD>(Special form) Create a global name (for a procedure or other value). +<TR><TD><CODE>display</CODE><TD>Print the argument without starting a new line. +<TR><TD><CODE>empty?</CODE><TD>Is the argument empty, i.e., the empty word <CODE>""</CODE> or the empty sentence <CODE>()</CODE>? +<TR><TD><CODE>eof-object?</CODE><TD>Is the argument an end-of-file object? +<TR><TD><CODE>equal?</CODE><TD>Are the two arguments the same thing? +<TR><TD><CODE>error</CODE><TD>Print an error message and return to the Scheme prompt. +<TR><TD><CODE>even?</CODE><TD>Is the argument an even integer? +<TR><TD><CODE>every</CODE><TD>Apply a function to each element of a word or +sentence (see <A HREF="../ssch8/higher.html#every">here</A>). +<TR><TD><CODE>expt</CODE><TD>Raise the first argument to the power of the second. +<TR><TD><CODE>filter</CODE><TD>Select a subset of a list (see <A +HREF="../ssch17/lists.html#filter">here</A>). +<TR><TD><CODE>first</CODE><TD>Return first letter of a word, or first word of a sentence. +<TR><TD><CODE>floor</CODE><TD>Round a number down to the nearest integer. +<TR><TD><CODE>for-each</CODE><TD>Perform a computation for each element of a list. +<TR><TD><CODE>if</CODE><TD>(Special form) Choose between two alternatives (see +<A HREF="../ssch6/true.html#spif">here</A>). +<TR><TD><CODE>integer?</CODE><TD>Is the argument an integer? +<TR><TD><CODE>item</CODE><TD>Return the $n$th letter of a word, or $n$th word of a sentence. +<TR><TD><CODE>keep</CODE><TD>Select a subset of a word or sentence (see <A +HREF="../ssch8/higher.html#keep">here</A>). +<TR><TD><CODE>lambda</CODE><TD>(Special form) Create a new procedure (see Chapter \lambchop). +<TR><TD><CODE>last</CODE><TD>Return last letter of a word, or last word of a sentence. +<TR><TD><CODE>length</CODE><TD>Return the number of elements in a list. +<TR><TD><CODE>let</CODE><TD>(Special form) Give temporary names to values (see +<A HREF="../ssch7/variables.html#splet">here</A>). +<TR><TD><CODE>list</CODE><TD>Return a list containing the arguments. +<TR><TD><CODE>list->vector</CODE><TD>Return a vector with the same elements as the list. +<TR><TD><CODE>list-ref</CODE><TD>Select an element from a list (counting from zero). +<TR><TD><CODE>list?</CODE><TD>Is the argument a list? +<TR><TD><CODE>load</CODE><TD>Read a program file into Scheme. +<TR><TD><CODE>log</CODE><TD>Return the logarithm of a number. +<TR><TD><CODE>make-node</CODE><TD>Create a new node of a tree. +<TR><TD><CODE>make-vector</CODE><TD>Create a new vector of the given length. +<TR><TD><CODE>map</CODE><TD>Apply a function to each element of a list (see <A +HREF="../ssch17/lists.html#map">here</A>). +<TR><TD><CODE>max</CODE><TD>Return the largest of the arguments. +<TR><TD><CODE>member</CODE><TD>Return subset of a list starting with selected element, or <CODE>#f</CODE>. +<TR><TD><CODE>member?</CODE><TD>Is the first argument an element of the +second? (see <A HREF="../ssch6/true.html#memq">here</A>). +<TR><TD><CODE>min</CODE><TD>Return the smallest of the arguments. +<TR><TD><CODE>newline</CODE><TD>Go to a new line of printing. +<TR><TD><CODE>not</CODE><TD>Return <CODE>#t</CODE> if argument is <CODE>#f</CODE>; return <CODE>#f</CODE> otherwise. +<TR><TD><CODE>null?</CODE><TD>Is the argument the empty list? +<TR><TD><CODE>number?</CODE><TD>Is the argument a number? +<TR><TD><CODE>odd?</CODE><TD>Is the argument an odd integer? +<TR><TD><CODE>open-input-file</CODE><TD>Open a file for reading, return a port. +<TR><TD><CODE>open-output-file</CODE><TD>Open a file for writing, return a port. +<TR><TD><CODE>or</CODE><TD>(Special form) Are any of the arguments true values (i.e., not <CODE>#f</CODE>)? +<TR><TD><CODE>procedure?</CODE><TD>Is the argument a procedure? +<TR><TD><CODE>quote</CODE><TD>(Special form) Return the argument, unevaluated +(see <A HREF="../ssch5/words.html#spquote">here</A>). +<TR><TD><CODE>quotient</CODE><TD>Divide numbers, but round down to integer. +<TR><TD><CODE>random</CODE><TD>Return a random number ≥ 0 and smaller than the argument. +<TR><TD><CODE>read</CODE><TD>Read an expression from the keyboard (or a file). +<TR><TD><CODE>read-line</CODE><TD>Read a line from the keyboard (or a file), returning a sentence. +<TR><TD><CODE>read-string</CODE><TD>Read a line from the keyboard (or a file), returning a string. +<TR><TD><CODE>reduce</CODE><TD>Apply a combining function to all elements of +list (see <A HREF="../ssch17/lists.html#reduce">here</A>). +<TR><TD><CODE>remainder</CODE><TD>Return the remainder from dividing the first number by the second. +<TR><TD><CODE>repeated</CODE><TD>Return the function described by +<I>f</I>(<I>f</I>(⋅⋅⋅(<I>f</I>(<I>x</I>)))) (see <A +HREF="../ssch8/higher.html#repeated">here</A>). +<TR><TD><CODE>round</CODE><TD>Round a number to the nearest integer. +<TR><TD><CODE>se</CODE><TD>Abbreviation for <CODE>sentence</CODE>. +<TR><TD><CODE>sentence</CODE><TD>Join the arguments together into a big sentence. +<TR><TD><CODE>sentence?</CODE><TD>Is the argument a sentence? +<TR><TD><CODE>show</CODE><TD>Print the argument and start a new line. +<TR><TD><CODE>show-line</CODE><TD>Show the argument sentence without surrounding parentheses. +<TR><TD><CODE>sin</CODE><TD>Return the sine of a number (from trigonometry). +<TR><TD><CODE>sqrt</CODE><TD>Return the square root of a number. +<TR><TD><CODE>square</CODE><TD>Not a primitive! <CODE>(define (square x) (* x x))</CODE> +<TR><TD><CODE>trace</CODE><TD>Report on all future invocations of a procedure. +<TR><TD><CODE>untrace</CODE><TD>Undo the effect of <CODE>trace</CODE>. +<TR><TD><CODE>vector</CODE><TD>Create a vector with the arguments as elements. +<TR><TD><CODE>vector->list</CODE><TD>Return a list with the same elements as the vector. +<TR><TD><CODE>vector-length</CODE><TD>Return the number of elements in a vector. +<TR><TD><CODE>vector-ref</CODE><TD>Return an element of a vector (counting from zero). +<TR><TD><CODE>vector-set!</CODE><TD>Replace an element in a vector. +<TR><TD><CODE>vector?</CODE><TD>Is the argument a vector? +<TR><TD><CODE>vowel?</CODE><TD>Not a primitive! <CODE>(define (vowel? x) (member? x '(a e i o u)))</CODE> +<TR><TD><CODE>word</CODE><TD>Joins words into one big word. +<TR><TD><CODE>word?</CODE><TD>Is the argument a word? (Note: numbers are words.) +<TR><TD><CODE>write</CODE><TD>Print the argument in machine-readable form (see +<A HREF="../ssch22/files.html#spwrite">here</A>). +</TABLE> +\htend +\bye diff --git a/js/games/nluqo.github.io/~bh/ssch27/appendix-funlist.html b/js/games/nluqo.github.io/~bh/ssch27/appendix-funlist.html new file mode 100644 index 0000000..d53f51c --- /dev/null +++ b/js/games/nluqo.github.io/~bh/ssch27/appendix-funlist.html @@ -0,0 +1,182 @@ +<P> + +<P> +<HTML> +<HEAD> +<TITLE>Simply Scheme: Alphabetical Table of Scheme Primitives</TITLE> +</HEAD> +<BODY> +<CITE>Simply Scheme</CITE>: +<CITE>Introducing Computer Science</CITE> 2/e Copyright (C) 1999 MIT +<H1>Alphabetical Table of Scheme Primitives</H1> + +<TABLE width="100%"><TR><TD> +<IMG SRC="../simply.jpg" ALT="cover photo"> +<TD><TABLE> +<TR><TD align="right"><CITE><A HREF="http://www.cs.berkeley.edu/~bh/">Brian +Harvey</A><BR>University of California, Berkeley</CITE> +<TR><TD align="right"><CITE><A HREF="http://ccrma.stanford.edu/~matt">Matthew +Wright</A><BR>University of California, Santa Barbara</CITE> +<TR><TD align="right"><BR> +<TR><TD align="right"><A HREF="../pdf/ssch27.pdf">Download PDF version</A> +<TR><TD align="right"><A HREF="../ss-toc2.html">Back to Table of Contents</A> +<TR><TD align="right"><A HREF="credits.html"><STRONG>BACK</STRONG></A> +chapter thread <A HREF="glossary.html"><STRONG>NEXT</STRONG></A> +<TR><TD align="right"><A HREF="http://mitpress.mit.edu/0262082810">MIT +Press web page for <CITE>Simply Scheme</CITE></A> +</TABLE></TABLE> + +<HR> + +<A NAME="funlist"></A> + +<P>This table does not represent the complete Scheme language. It includes the +nonstandard Scheme primitives that we use in this book, and it omits many +standard ones that are not needed here. + +<P> + +<P><TABLE> +<TR><TD><CODE>'</CODE> +<TD>Abbreviation for <CODE>(quote</CODE> …<CODE>)</CODE>. +<TR><TD><A NAME="g202"></A><CODE>*</CODE><TD>Multiply numbers. +<TR><TD><A NAME="g203"></A><CODE>+</CODE><TD>Add numbers. +<TR><TD><A NAME="g204"></A><CODE>-</CODE><TD>Subtract numbers. +<TR><TD><A NAME="g205"></A><CODE>/</CODE><TD>Divide numbers. +<TR><TD><CODE><</CODE><TD>Is the first argument less than the second? +<TR><TD><CODE><=</CODE><TD>Is the first argument less than or equal to the second? +<TR><TD><CODE>=</CODE><TD>Are two numbers equal? (Like <CODE>equal?</CODE> but works only for numbers). +<TR><TD><CODE>></CODE><TD>Is the first argument greater than the second? +<TR><TD><CODE>>=</CODE><TD>Is the first argument greater than or equal to the second? +<TR><TD><CODE>abs</CODE><TD>Return the absolute value of the argument. +<TR><TD><CODE>accumulate</CODE><TD>Apply a combining function to all elements +(see <A HREF="../ssch8/higher.html#accum">here</A>). +<TR><TD><CODE>align</CODE><TD>Return a string spaced to a given width (see <A +HREF="../ssch20/io.html#spformat">here</A>). +<TR><TD><CODE>and</CODE><TD>(Special form) Are all of the arguments true values (i.e., not <CODE>#f</CODE>)? +<TR><TD><CODE>appearances</CODE><TD>Return the number of times the first argument is in the second. +<TR><TD><CODE>append</CODE><TD>Return a list containing the elements of the argument lists. +<TR><TD><CODE>apply</CODE><TD>Apply a function to the arguments in a list. +<TR><TD><CODE>assoc</CODE><TD>Return association list entry matching key. +<TR><TD><CODE>before?</CODE><TD>Does the first argument come alphabetically before the second? +<TR><TD><CODE>begin</CODE><TD>(Special form) Carry out a sequence of +instructions (see <A HREF="../ssch20/io.html#beg">here</A>). +<TR><TD><CODE>bf</CODE><TD>Abbreviation for <CODE>butfirst</CODE>. +<TR><TD><CODE>bl</CODE><TD>Abbreviation for <CODE>butlast</CODE>. +<TR><TD><CODE>boolean?</CODE><TD>Return true if the argument is <CODE>#t</CODE> or <CODE>#f</CODE>. +<TR><TD><CODE>butfirst</CODE><TD>Return all but the first letter of a word, or word of a sentence. +<TR><TD><CODE>butlast</CODE><TD>Return all but the last letter of a word, or word of a sentence. +<TR><TD><CODE>c...r</CODE><TD>Combinations of <CODE>car</CODE> and +<CODE>cdr</CODE> (see <A HREF="../ssch17/lists.html#cadr">here</A>). +<TR><TD><CODE>car</CODE><TD>Return the first element of a list. +<TR><TD><CODE>cdr</CODE><TD>Return all but the first element of a list. +<TR><TD><A NAME="g206"></A><CODE>ceiling</CODE><TD>Round a number up to the nearest integer. +<TR><TD><CODE>children</CODE><TD>Return a list of the children of a tree node. +<TR><TD><CODE>close-all-ports</CODE><TD>Close all open input and output ports. +<TR><TD><CODE>close-input-port</CODE><TD>Close an input port. +<TR><TD><CODE>close-output-port</CODE><TD>Close an output port. +<TR><TD><CODE>cond</CODE><TD>(Special form) Choose among several alternatives +(see <A HREF="../ssch6/true.html#cond">here</A>). +<TR><TD><CODE>cons</CODE><TD>Prepend an element to a list. +<TR><TD><A NAME="g207"></A><CODE>cos</CODE><TD>Return the cosine of a number (from trigonometry). +<TR><TD><CODE>count</CODE><TD>Return the number of letters in a word or number of words in a sentence. +<TR><TD><CODE>datum</CODE><TD>Return the datum of a tree node. +<TR><TD><CODE>define</CODE><TD>(Special form) Create a global name (for a procedure or other value). +<TR><TD><CODE>display</CODE><TD>Print the argument without starting a new line. +<TR><TD><CODE>empty?</CODE><TD>Is the argument empty, i.e., the empty word <CODE>""</CODE> or the empty sentence <CODE>()</CODE>? +<TR><TD><CODE>eof-object?</CODE><TD>Is the argument an end-of-file object? +<TR><TD><CODE>equal?</CODE><TD>Are the two arguments the same thing? +<TR><TD><A NAME="g208"></A><CODE>error</CODE><TD>Print an error message and return to the Scheme prompt. +<TR><TD><A NAME="g209"></A><CODE>even?</CODE><TD>Is the argument an even integer? +<TR><TD><CODE>every</CODE><TD>Apply a function to each element of a word or +sentence (see <A HREF="../ssch8/higher.html#every">here</A>). +<TR><TD><A NAME="g210"></A><CODE>expt</CODE><TD>Raise the first argument to the power of the second. +<TR><TD><CODE>filter</CODE><TD>Select a subset of a list (see <A +HREF="../ssch17/lists.html#filter">here</A>). +<TR><TD><CODE>first</CODE><TD>Return first letter of a word, or first word of a sentence. +<TR><TD><A NAME="g211"></A><CODE>floor</CODE><TD>Round a number down to the nearest integer. +<TR><TD><CODE>for-each</CODE><TD>Perform a computation for each element of a list. +<TR><TD><CODE>if</CODE><TD>(Special form) Choose between two alternatives (see +<A HREF="../ssch6/true.html#spif">here</A>). +<TR><TD><A NAME="g212"></A><CODE>integer?</CODE><TD>Is the argument an integer? +<TR><TD><CODE>item</CODE><TD>Return the $n$th letter of a word, or $n$th word of a sentence. +<TR><TD><CODE>keep</CODE><TD>Select a subset of a word or sentence (see <A +HREF="../ssch8/higher.html#keep">here</A>). +<TR><TD><CODE>lambda</CODE><TD>(Special form) Create a new procedure (see Chapter \lambchop). +<TR><TD><CODE>last</CODE><TD>Return last letter of a word, or last word of a sentence. +<TR><TD><CODE>length</CODE><TD>Return the number of elements in a list. +<TR><TD><CODE>let</CODE><TD>(Special form) Give temporary names to values (see +<A HREF="../ssch7/variables.html#splet">here</A>). +<TR><TD><CODE>list</CODE><TD>Return a list containing the arguments. +<TR><TD><CODE>list->vector</CODE><TD>Return a vector with the same elements as the list. +<TR><TD><CODE>list-ref</CODE><TD>Select an element from a list (counting from zero). +<TR><TD><CODE>list?</CODE><TD>Is the argument a list? +<TR><TD><A NAME="g213"></A><CODE>load</CODE><TD>Read a program file into Scheme. +<TR><TD><A NAME="g214"></A><CODE>log</CODE><TD>Return the logarithm of a number. +<TR><TD><CODE>make-node</CODE><TD>Create a new node of a tree. +<TR><TD><CODE>make-vector</CODE><TD>Create a new vector of the given length. +<TR><TD><CODE>map</CODE><TD>Apply a function to each element of a list (see <A +HREF="../ssch17/lists.html#map">here</A>). +<TR><TD><A NAME="g215"></A><CODE>max</CODE><TD>Return the largest of the arguments. +<TR><TD><CODE>member</CODE><TD>Return subset of a list starting with selected element, or <CODE>#f</CODE>. +<TR><TD><CODE>member?</CODE><TD>Is the first argument an element of the +second? (see <A HREF="../ssch6/true.html#memq">here</A>). +<TR><TD><A NAME="g216"></A><CODE>min</CODE><TD>Return the smallest of the arguments. +<TR><TD><CODE>newline</CODE><TD>Go to a new line of printing. +<TR><TD><CODE>not</CODE><TD>Return <CODE>#t</CODE> if argument is <CODE>#f</CODE>; return <CODE>#f</CODE> otherwise. +<TR><TD><CODE>null?</CODE><TD>Is the argument the empty list? +<TR><TD><CODE>number?</CODE><TD>Is the argument a number? +<TR><TD><A NAME="g217"></A><CODE>odd?</CODE><TD>Is the argument an odd integer? +<TR><TD><CODE>open-input-file</CODE><TD>Open a file for reading, return a port. +<TR><TD><CODE>open-output-file</CODE><TD>Open a file for writing, return a port. +<TR><TD><CODE>or</CODE><TD>(Special form) Are any of the arguments true values (i.e., not <CODE>#f</CODE>)? +<TR><TD><A NAME="g218"></A><CODE>procedure?</CODE><TD>Is the argument a procedure? +<TR><TD><CODE>quote</CODE><TD>(Special form) Return the argument, unevaluated +(see <A HREF="../ssch5/words.html#spquote">here</A>). +<TR><TD><A NAME="g219"></A><CODE>quotient</CODE><TD>Divide numbers, but round down to integer. +<TR><TD><A NAME="g220"></A><CODE>random</CODE><TD>Return a random number ≥ 0 and smaller than the argument. +<TR><TD><CODE>read</CODE><TD>Read an expression from the keyboard (or a file). +<TR><TD><CODE>read-line</CODE><TD>Read a line from the keyboard (or a file), returning a sentence. +<TR><TD><CODE>read-string</CODE><TD>Read a line from the keyboard (or a file), returning a string. +<TR><TD><CODE>reduce</CODE><TD>Apply a combining function to all elements of +list (see <A HREF="../ssch17/lists.html#reduce">here</A>). +<TR><TD><A NAME="g221"></A><CODE>remainder</CODE><TD>Return the remainder from dividing the first number by the second. +<TR><TD><CODE>repeated</CODE><TD>Return the function described by +<I>f</I>(<I>f</I>(⋅⋅⋅(<I>f</I>(<I>x</I>)))) (see <A +HREF="../ssch8/higher.html#repeated">here</A>). +<TR><TD><A NAME="g222"></A><CODE>round</CODE><TD>Round a number to the nearest integer. +<TR><TD><CODE>se</CODE><TD>Abbreviation for <CODE>sentence</CODE>. +<TR><TD><CODE>sentence</CODE><TD>Join the arguments together into a big sentence. +<TR><TD><CODE>sentence?</CODE><TD>Is the argument a sentence? +<TR><TD><CODE>show</CODE><TD>Print the argument and start a new line. +<TR><TD><CODE>show-line</CODE><TD>Show the argument sentence without surrounding parentheses. +<TR><TD><A NAME="g223"></A><CODE>sin</CODE><TD>Return the sine of a number (from trigonometry). +<TR><TD><A NAME="g224"></A><CODE>sqrt</CODE><TD>Return the square root of a number. +<TR><TD><CODE>square</CODE><TD>Not a primitive! <CODE>(define (square x) (* x x))</CODE> +<TR><TD><CODE>trace</CODE><TD>Report on all future invocations of a procedure. +<TR><TD><CODE>untrace</CODE><TD>Undo the effect of <CODE>trace</CODE>. +<TR><TD><CODE>vector</CODE><TD>Create a vector with the arguments as elements. +<TR><TD><CODE>vector->list</CODE><TD>Return a list with the same elements as the vector. +<TR><TD><CODE>vector-length</CODE><TD>Return the number of elements in a vector. +<TR><TD><CODE>vector-ref</CODE><TD>Return an element of a vector (counting from zero). +<TR><TD><CODE>vector-set!</CODE><TD>Replace an element in a vector. +<TR><TD><CODE>vector?</CODE><TD>Is the argument a vector? +<TR><TD><CODE>vowel?</CODE><TD>Not a primitive! <CODE>(define (vowel? x) (member? x '(a e i o u)))</CODE> +<TR><TD><CODE>word</CODE><TD>Joins words into one big word. +<TR><TD><CODE>word?</CODE><TD>Is the argument a word? (Note: numbers are words.) +<TR><TD><CODE>write</CODE><TD>Print the argument in machine-readable form (see +<A HREF="../ssch22/files.html#spwrite">here</A>). +</TABLE> + +<HR> +<P><A HREF="../ss-toc2.html">(back to Table of Contents)</A><P> +<A HREF="credits.html"><STRONG>BACK</STRONG></A> +chapter thread <A HREF="glossary.html"><STRONG>NEXT</STRONG></A> + +<P> +<ADDRESS> +<A HREF="../index.html">Brian Harvey</A>, +<CODE>bh@cs.berkeley.edu</CODE> +</ADDRESS> +</BODY> +</HTML> diff --git a/js/games/nluqo.github.io/~bh/ssch27/appendix-gpl.html b/js/games/nluqo.github.io/~bh/ssch27/appendix-gpl.html new file mode 100644 index 0000000..f44cd42 --- /dev/null +++ b/js/games/nluqo.github.io/~bh/ssch27/appendix-gpl.html @@ -0,0 +1,403 @@ +<P> + +<P><HTML> +<HEAD> +<TITLE>Simply Scheme Appendix D: GNU General Public License</TITLE> +</HEAD> +<BODY> +<CITE>Simply Scheme</CITE>: +<CITE>Introducing Computer Science</CITE> 2/e Copyright (C) 1999 MIT +<H2>Appendix D</H2> +<H1>GNU General Public License</H1> + +<TABLE width="100%"><TR><TD> +<IMG SRC="../simply.jpg" ALT="cover photo"> +<TD><TABLE> +<TR><TD align="right"><CITE><A HREF="http://www.cs.berkeley.edu/~bh/">Brian +Harvey</A><BR>University of California, Berkeley</CITE> +<TR><TD align="right"><CITE><A HREF="http://ccrma.stanford.edu/~matt">Matthew +Wright</A><BR>University of California, Santa Barbara</CITE> +<TR><TD align="right"><BR> +<TR><TD align="right"><A HREF="../pdf/ssch27.pdf">Download PDF version</A> +<TR><TD align="right"><A HREF="../ss-toc2.html">Back to Table of Contents</A> +<TR><TD align="right"><A HREF="appendix-simply.html"><STRONG>BACK</STRONG></A> +chapter thread <A HREF="credits.html"><STRONG>NEXT</STRONG></A> +<TR><TD align="right"><A HREF="http://mitpress.mit.edu/0262082810">MIT +Press web page for <CITE>Simply Scheme</CITE></A> +</TABLE></TABLE> + +<HR> + +<P>The following software license, written by the Free Software +Foundation, applies to the Scheme programs in this book. We chose to use +this license in order to encourage the free sharing of software—our own +and, we hope, yours. + +<P><CENTER>GNU GENERAL PUBLIC LICENSE</CENTER> +<CENTER>Version 2, June 1991</CENTER> +<P> +Copyright (C) 1989, 1991 Free Software Foundation, Inc. + +<P>675 Mass Ave, Cambridge, MA 02139, USA +<P>Everyone is permitted to copy and distribute verbatim copies +of this license document, but changing it is not allowed. +<P><CENTER>Preamble</CENTER> +<P>The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software—to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + +<P>When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + +<P>To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + +<P>For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + +<P>We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + +<P>Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + +<P>Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + +<P>The precise terms and conditions for copying, distribution and +modification follow. + +<P><CENTER>GNU GENERAL PUBLIC LICENSE</CENTER> +<P><CENTER>TERMS AND CONDITIONS FOR COPYING,</CENTER> +<CENTER>DISTRIBUTION AND MODIFICATION</CENTER> +<P> +0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +<P>Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + +<P>1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +<P>You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + +<P>2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + +<P><BLOCKQUOTE>a) You must cause the modified files to carry prominent notices +stating that you changed the files and the date of any change. + +<P>b) You must cause any work that you distribute or publish, that in +whole or in part contains or is derived from the Program or any +part thereof, to be licensed as a whole at no charge to all third +parties under the terms of this License. + +<P>c) If the modified program normally reads commands interactively +when run, you must cause it, when started running for such +interactive use in the most ordinary way, to print or display an +announcement including an appropriate copyright notice and a +notice that there is no warranty (or else, saying that you provide +a warranty) and that users may redistribute the program under +these conditions, and telling the user how to view a copy of this +License. (Exception: if the Program itself is interactive but +does not normally print such an announcement, your work based on +the Program is not required to print an announcement.) + +<P></BLOCKQUOTE> + +<P>These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +<P>Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +<P>In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + +<P>3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + +<P><BLOCKQUOTE>a) Accompany it with the complete corresponding machine-readable +source code, which must be distributed under the terms of Sections +1 and 2 above on a medium customarily used for software interchange; or, + +<P>b) Accompany it with a written offer, valid for at least three +years, to give any third party, for a charge no more than your +cost of physically performing source distribution, a complete +machine-readable copy of the corresponding source code, to be +distributed under the terms of Sections 1 and 2 above on a medium +customarily used for software interchange; or, + +<P>c) Accompany it with the information you received as to the offer +to distribute corresponding source code. (This alternative is +allowed only for noncommercial distribution and only if you +received the program in object code or executable form with such +an offer, in accord with Subsection b above.) + +<P></BLOCKQUOTE> + +<P>The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +<P>If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + +<P>4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + +<P>5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + +<P>6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + +<P>7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program +by all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +<P>If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +<P>It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +<P>This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + +<P>8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + +<P>9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +<P>Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + +<P>10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + +<P><P><CENTER>NO WARRANTY</CENTER> +<P> +11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR +THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE +RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD +THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + +<P>12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. +<P><CENTER>END OF TERMS AND CONDITIONS</CENTER> + +<P><P><CENTER>How to Apply These Terms to Your New Programs</CENTER> +<P> +If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + +<P>To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + +<P><PRE><one line to give the program's name + and a brief idea of what it does.> +Copyright (C) 19yy <name of author> + +This program is free software; you can +redistribute it and/or modify it under the terms +of the GNU General Public License as published +by the Free Software Foundation; either version +2 of the License, or (at your option) any later +version. + +This program is distributed in the hope that it +will be useful, but WITHOUT ANY WARRANTY; +without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR +PURPOSE. See the GNU General Public License for +more details. + +You should have received a copy of the GNU +General Public License along with this program; +if not, write to the Free Software Foundation, +Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +</PRE> + +<P>Also add information on how to contact you by electronic and paper mail. + +<P>If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + +<P><PRE>Gnomovision version 69, +Copyright (C) 19yy name of author +Gnomovision comes with ABSOLUTELY NO WARRANTY; for +details type `show w'. This is free software, and +you are welcome to redistribute it under certain +conditions; type `show c' for details. +</PRE> + +<P>The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items—whatever suits your program. + +<P>You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + +<P><PRE>Yoyodyne, Inc., hereby disclaims all copyright +interest in the program `Gnomovision' (which makes +passes at compilers) written by James Hacker. + +<signature of Ty Coon>, 1 April 1989 +Ty Coon, President of Vice +</PRE> + +<P>This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. + +<P> +<HR> +<P><A HREF="../ss-toc2.html">(back to Table of Contents)</A><P> +<A HREF="appendix-simply.html"><STRONG>BACK</STRONG></A> +chapter thread <A HREF="credits.html"><STRONG>NEXT</STRONG></A> + +<P> +<ADDRESS> +<A HREF="../index.html">Brian Harvey</A>, +<CODE>bh@cs.berkeley.edu</CODE> +</ADDRESS> +</BODY> +</HTML> diff --git a/js/games/nluqo.github.io/~bh/ssch27/appendix-running.html b/js/games/nluqo.github.io/~bh/ssch27/appendix-running.html new file mode 100644 index 0000000..a52f9e8 --- /dev/null +++ b/js/games/nluqo.github.io/~bh/ssch27/appendix-running.html @@ -0,0 +1,426 @@ +<HTML> +<HEAD> +<TITLE>Simply Scheme Appendix A: Running Scheme</TITLE> +</HEAD> +<BODY> +<CITE>Simply Scheme</CITE>: +<CITE>Introducing Computer Science</CITE> 2/e Copyright (C) 1999 MIT +<H2>Appendix A</H2> +<H1>Running Scheme</H1> + +<TABLE width="100%"><TR><TD> +<IMG SRC="../simply.jpg" ALT="cover photo"> +<TD><TABLE> +<TR><TD align="right"><CITE><A HREF="http://www.cs.berkeley.edu/~bh/">Brian +Harvey</A><BR>University of California, Berkeley</CITE> +<TR><TD align="right"><CITE><A HREF="http://ccrma.stanford.edu/~matt">Matthew +Wright</A><BR>University of California, Santa Barbara</CITE> +<TR><TD align="right"><BR> +<TR><TD align="right"><A HREF="../pdf/ssch27.pdf">Download PDF version</A> +<TR><TD align="right"><A HREF="../ss-toc2.html">Back to Table of Contents</A> +<TR><TD align="right"><A HREF="../ssch26/preview.html"><STRONG>BACK</STRONG></A> +chapter thread <A HREF="appendix-cl.html"><STRONG>NEXT</STRONG></A> +<TR><TD align="right"><A HREF="http://mitpress.mit.edu/0262082810">MIT +Press web page for <CITE>Simply Scheme</CITE></A> +</TABLE></TABLE> + +<HR> + +<P>The precise incantations needed to start Scheme depend on the particular +version you're using and the model of computer and operating system you have. +It's beyond the scope of this book to teach you the first steps in using a +computer; we assume you've already used other programs, if not Scheme. +But in this appendix we suggest a few general ideas and point out some +knotty details. + +<P>One thing that beginners often forget is that a computer generally has many +different programs available, and each one has its own capabilities and its +own method of operation. If you think of yourself as interacting with "the +computer," you're likely to try to use a command suitable for one program +when you're actually using a different program. In learning to program in +Scheme, you'll probably use at least three programs: Scheme itself, the +operating system's <EM>shell</EM> (which is callled <EM>finder</EM> on the +Macintosh and <EM>explorer</EM> on Windows), and a text editor. (The text +editor may be part of the Scheme package or it may be an entirely separate +program.) The shell allows you to run other programs, such as a printing +utility or an electronic mail reader. + +<P>If you say <CODE>(+ 2 3)</CODE> to your text editor, it won't respond by printing +<CODE>5</CODE>. Instead, it will insert the seven characters that you typed into +the file that you're editing. If you type the same thing to Scheme, it will +evaluate the expression. + +<P><H2>The Program Development Cycle</H2> + +<P>Scheme is an interactive language: You can write a program by typing +its definition directly into the Scheme interpreter. This ability +to interact with Scheme is a great advantage for one-time +calculations and for exploratory work, but it's not the best +approach for the systematic development of a large program. + +<P>There are two issues to consider. First, when writing a large program, you +generally don't get it perfect the first time. You make both typing errors +and program logic errors, and so you must be able to revise a definition. +Typing directly to Scheme, the only way to make such a revision is to retype +the entire definition. Second, Scheme does not provide a mechanism to save +your work in a permanent file. + +<P>For these reasons, programs are generally typed into another program, a text +editor, rather than directly at the Scheme prompt. As we'll explain in the +next section, there are several ways in which an editing program can be <EM>integrated</EM> with Scheme, so that the work you do in the editor can be +communicated easily to Scheme. But the distinction between Scheme and the +editor is easiest to understand if we start by considering the worst possible +situation, in which the two are not integrated. + +<P>Imagine, therefore, that you have two separate programs available on +your computer. One program is a Scheme interpreter. When you start +Scheme, you may see some initial message, and then you see a prompt, +which is a signal from Scheme that it's ready for you to type +something. In this book we've used the character "<CODE>></CODE>" as the +prompt. Then, as we explain in the text, you can type an +expression, and Scheme will compute and print the value: + +<P><PRE>> (+ 2 3) +5 +</PRE> + +<P>Your other program is a text editor. This might be a +general-purpose word processing program, with facilities for +fancy text formatting, or it might be an editor intended +specifically for computer programs. Many editors "know" about +Lisp programs and have helpful features, such as automatic +indentation, selection of complete expressions, and showing you the +matching open parenthesis when you type a close parenthesis. + +<P>To write a program, you use the editor. Although you are typing +Scheme expressions, you're not talking to Scheme itself, and so the +expressions are not evaluated as you type them. Instead, they just +appear on the screen like any other text. When you're ready to try +out your program, you tell the editor to save the text in a file. +(The command to save the program text is the same as it would be for +any other text; we assume that you already know how to use the +editor on your computer.) You can give the file any name you want, +although many people like to use names like <CODE><EM>something</EM></CODE><CODE>.scm</CODE> to make it easy to recognize files that contain Scheme +programs. + +<P>Now you switch from the editor to Scheme. To read your program file into +Scheme, you enter the expression + +<P><PRE>(load "<EM>something</EM>.scm") +</PRE> + +<P>This tells Scheme to read expressions from the specified +file.<A NAME="text1" HREF="appendix-running.html#ft1">[1]</A> + +<P>Once Scheme has read the program definitions from your file, you +can continue typing expressions to Scheme in order to test your +program. If this testing uncovers an error, you will want to +change some definition. Instead of typing the changed definition +directly into Scheme, which would only make a temporary change in +your program, you switch back to the editor and make the change in +your program file. Then switch back to Scheme, and <CODE>load</CODE> the +corrected file. + +<P>This sequence of steps—edit a file, make changes, save the +file, switch to Scheme, load the file, test the program, find an +error—is called a "development cycle" because what comes +after "find an error" is editing the file, beginning another +round of the same steps. + +<P><H2>Integrated Editing</H2> + +<P>The development process can become much more convenient if Scheme and the +editor "know about" each other. For example, instead of having to reload +an entire file when you change one procedure definition, it's faster if your +editor can tell Scheme just the one new definition. There are three general +approaches to this integration: First, the editor can be in overall charge, +with the Scheme interpreter running under control of the editor. Second, +Scheme can be in charge, with the editor running under Scheme's +supervision. Third, Scheme and the editor can be separate programs, both +running under control of a third program, such as a window system, that +allows information to be transferred between them. + +<P>If you're using a Unix system, you will be able to take a +separate editor program and run Scheme from within that editor. +The editor can copy any part of your program into the running +Scheme, as if you had typed it to Scheme yourself. We use Jove, +a free, small, fast version of EMACS. Most people use the more +featureful GNU version of EMACS, which is installed on most Unix +systems and available at <CODE>ftp://prep.ai.mit.edu/pub/gnu/</CODE> and +many mirror sites for download. + +<P>If you're using a Macintosh or Windows version of Scheme, it will probably +come with its own text editor and instructions on how to use it. These +editors typically provide standard word-processing features such as cut and +paste, search and replace, and saving files. Also, they typically have a +way to ask Scheme to evaluate an expression directly from the editor. + +<P>If you're using SCM under DOS, you should read the section "Editing +Scheme Code" in the <CODE>README</CODE> file that comes with the SCM +distribution. It will explain that editing can be done in different +ways depending on the precise software available to you. You can +buy a DOS editor that works like the Unix editors, or you can ask +SCM to start a separate editor program while SCM remains active. + +<P>Finally, if you're running Scheme under Windows or another windowing +operating system (like X or the Macintosh Finder), you can run any editor in +another window and use the cut and paste facility to transfer information +between the editor and Scheme. + +<P><H2>Getting Our Programs</H2> + +<P>This book uses some programs that we wrote in Scheme. You'll want these +files available to you while reading the book: + +<P><TABLE> +<TR><TD><CODE>simply.scm</CODE> +<TD>extended Scheme primitives +<TR><TD><CODE>functions.scm</CODE> +<TD>the <CODE>functions</CODE> program of Chapters 2 and 21 +<TR><TD><CODE>ttt.scm</CODE> +<TD>the tic-tac-toe example from Chapter 10 +<TR><TD><CODE>match.scm</CODE> +<TD>the pattern matcher example from Chapter 16 +<TR><TD><CODE>spread.scm</CODE> +<TD>the spreadsheet program example from Chapter 24 +<TR><TD><CODE>database.scm</CODE> +<TD>the beginning of the database project +<TR><TD><CODE>copyleft</CODE> +<TD>the GNU General Public License (see Appendix D) +</TABLE><P> + +In particular, the file <CODE>simply.scm</CODE> must be loaded into Scheme to allow +anything in the book to work. Some Scheme systems allow you to load such a +"startup" file permanently, so that it'll be there automatically from then +on. In other versions of Scheme, you must say + +<P><PRE>(load "simply.scm") +</PRE> + +<P>at the beginning of every Scheme session. + +<P>There are three ways to get these program files: + +<P><P><TABLE><TR><TH align="right" valign="top">•<TD> <TD valign="top">If you have access to the Internet, +the most recent versions of all these files can be found at +<CODE>ftp://anarres.cs.berkeley.edu/pub/scheme/</CODE> + +</TABLE> +<P><TABLE><TR><TH align="right" valign="top">•<TD> <TD valign="top">If you know someone who already has these files, you may copy them +and distribute them freely. (The programs are copyrighted but are provided +under a license that allows unlimited redistribution on a nonprofit +basis; see Appendix D.) +</TABLE><TABLE><TR><TH align="right" valign="top">•<TD> <TD valign="top">If you're stranded on a desert island with nothing but a computer and a +copy of this book, you can type them in yourself; complete listings for all +six programs, plus the GNU Public License, appear in the text of the book. + +</TABLE><P> + +<P><H2>Tuning Our Programs for Your System</H2> + +<P>Almost all of the programs we distribute with this book will work +without modification in the popular versions of Scheme. We've +included "defensive" procedures that allow our programs to work +even in versions that don't conform to current Scheme standards +in various ways. However, there are a few details that we +couldn't make uniform in all versions. + +<P>1. Many versions of Scheme include a <CODE>random</CODE> procedure to generate +random numbers, but the standard does not require it, and so we've provided +one just in case. If your Scheme includes a primitive <CODE>random</CODE>, it's +probably better than the one we provide, because we have no way to choose +a different starting value in each Scheme session. + +<P>Before loading <CODE>simply.scm</CODE> into Scheme, do the following experiment: + +<P><PRE>> (random 5) +</PRE> + +<P>If you get an error message, do nothing. If you get a random +number as the result, edit <CODE>simply.scm</CODE> and remove the definition of +<CODE>random</CODE>. + +<P>2. Do the following experiment: + +<P><PRE>> (error "Your error is" "string") +</PRE> + +<P>If the message you get doesn't include quotation marks around the +word <CODE>string</CODE>, then do nothing. But if you do see <CODE>"string"</CODE> with +quotation marks, edit <CODE>simply.scm</CODE> and change the definition of +<CODE>error-printform</CODE> to + +<P><PRE>(define (error-printform x) x) +</PRE> + +<P>3. Although the Scheme standard says that the <CODE>read</CODE> +procedure should not read the newline character following an +expression that it reads, some old versions of Scheme get this wrong. + +<P>After loading <CODE>simply.scm</CODE>, do the following experiment: + +<P><PRE>> (read-line) +</PRE> + +<P>End the line with the <CODE>return</CODE> or <CODE>enter</CODE> key +(whichever is appropriate in your version of Scheme) as usual, +but don't type a second <CODE>return</CODE> or <CODE>enter</CODE> yet. If +Scheme prints <CODE>()</CODE> right away, skip this paragraph; your +version of Scheme behaves correctly. If, on the other hand, +nothing happens, type another <CODE>return</CODE> or <CODE>enter</CODE>. In +this case you must edit <CODE>functions.scm</CODE> and remove the +invocation of <CODE>read-line</CODE> on the first line of the body of +the <CODE>functions</CODE> procedure. + +<P>4. There is a substantial loss of efficiency in treating strings of +digits as numbers in some contexts and as text in other contexts. When +we're treating 1024 as text, we want to be able to take its <CODE>butfirst</CODE>, +which should be 024. But in Scheme, <CODE>024</CODE> is the same as <CODE>24</CODE>, so +instead <CODE>butfirst</CODE> returns a string: + +<P><PRE>> (butfirst 1024) +"024" +</PRE> + +<P>Yet we want to be able to do arithmetic on this value: + +<P><PRE>> (+ 3 (butfirst 1024)) +27 +</PRE> + +<P>To accomplish this, we redefine all of Scheme's arithmetic +procedures to accept strings of digits and convert them to numbers. This +redefinition slows down all arithmetic, not just arithmetic on strange +numbers, and it's only rarely important to the programs we write. +Therefore, we've provided a way to turn this part of the package off and on +again. If your programs run too slowly, try saying + +<P><PRE>> (strings-are-numbers #f) +</PRE> + +<P>If you find that some program doesn't work because it tries to do +arithmetic on a digit string and gets an error message, you can say + +<P><PRE>> (strings-are-numbers #t) +</PRE> + +<P>to restore the original behavior of our programs. We recommend +that you leave <CODE>strings-are-numbers</CODE> true while exploring the first few +chapters, so that the behavior of the word data type will be consistent. +When you get to the large example programs, you may want to change to false. + +<P><H2>Loading Our Programs</H2> + +<P>Scheme's <CODE>load</CODE> procedure doesn't scan your entire disk looking for the +file you want to load. Instead, it only looks in one particular directory +(DOS/Unix) or folder (Macintosh/Windows). If you want to load our programs, +you have to make sure that Scheme can find them. + +<P>The first way to accomplish this is to give the full "path" as part of the +argument to <CODE>load</CODE>. Here are some examples:<A NAME="text2" HREF="appendix-running.html#ft2">[2]</A> + +<P><PRE>UNIX-SCHEME> (load "/usr/people/matt/scheme-stuff/simply.scm") + +WINDOWS-SCHEME> (load "c:\\scheme\\simply.scm") + +MAC-SCHEME> (load "Hard Disk:Scheme Folder:simply.scm") +</PRE> + +<P>Under Unix, directories in a path are separated by forward slash +characters. Under Windows and DOS, directories are separated by backward slash +characters, which have a special meaning to +Scheme. So you must use double +backslashes as in our example above. On a Macintosh, you separate the parts of +a path with colons. (However, most versions of Scheme for the Macintosh +or Windows +have a load command in one of the menus that opens a standard file +selection dialog box, so you can use that instead.) + +<P>The other possibility is to put the files in the place where your version of +Scheme looks for them. In many versions of Scheme, <CODE>load</CODE> looks +for files in the folder that contains the Scheme program itself. Put our +files in that folder. + +<P>On Unix, the default loading directory is whatever directory you're in at +the moment. If you want to work on different projects in different +directories, there's no way to make it so that <CODE>load</CODE> will always find +our files. (But see our suggestion about writing <CODE>book-load</CODE>.) + +<P><H2>Versions of Scheme</H2> + +<P>There are lots of them, both free and commercial. Three places to +look for pointers are + +<P><PRE>http://swissnet.ai.mit.edu/scheme-home.html +http://www.schemers.org +http://www.cs.indiana.edu/scheme-repository +</PRE> + +<P>In general, there are four things you should be sure to learn about +whatever version of Scheme you choose: + +<P><P><TABLE><TR><TH align="right" valign="top">•<TD> <TD valign="top">Most versions of Scheme include a <EM>debugger</EM> to help you find +program errors. If you call a primitive with an argument not in +its domain, for example, Scheme will start the debugger, which will have +features to let you find out where in your program the error occurred. +These debuggers vary greatly among versions of Scheme. The first thing +you should learn is how to <EM>leave</EM> the debugger, so you can get +back to a Scheme prompt! + +</TABLE><TABLE><TR><TH align="right" valign="top">•<TD> <TD valign="top">Many versions of Scheme will read an <EM>initialization file</EM> if +you create one. That is, when you start Scheme, it will look for a file +of a particular name (something like <CODE>init.scm</CODE>, but not usually +exactly that), and if there is such a file, Scheme will <CODE>load</CODE> it +automatically. You can copy our <CODE>simply.scm</CODE> file to the proper +filename for your version, and you'll have our added primitives available +every time you start Scheme. + +</TABLE><TABLE><TR><TH align="right" valign="top">•<TD> <TD valign="top">Most versions of Scheme provide a <CODE>trace</CODE> capability, but the +format of the trace results are quite different from one version to +another. + +</TABLE><TABLE><TR><TH align="right" valign="top">•<TD> <TD valign="top">If you are using a Macintosh, one thing to watch out for is that some +versions of Scheme expect you to use the ENTER key at the end of an +expression, while others expect you to use the RETURN key. + +</TABLE> + +<P><H2>Scheme Standards</H2> + +<P>The Web sites listed above will provide the latest version of the <EM>Revised<SUP><SMALL><I>n</I></SMALL></SUP> Report on the Algorithmic Language Scheme.</EM> You can +get the document in either Postscript or HTML format. + +<P>IEEE Standard 1178-1990, <EM>IEEE Standard for the Scheme Programming +Language,</EM> may be ordered from IEEE by calling 1-800-678-IEEE or +908-981-1393 or writing IEEE Service Center, 445 Hoes Lane, P.O. Box 1331, +Piscataway, NJ 08855-1331, and using order number SH14209 ($28 for IEEE +members, $40 for others). ISBN 1-55937-125-0. + +<P> +<HR> +<A NAME="ft1" HREF="appendix-running.html#text1">[1]</A> If you see an error message about "end of file" or "EOF," it +probably means that the file you are trying to load contains unbalanced +parentheses; you have started an expression with a left parenthesis, and the +file ended before Scheme saw a matching right parenthesis.<P> +<A NAME="ft2" HREF="appendix-running.html#text2">[2]</A> Suggestion for +instructors: when we teach this class, we define a procedure like + +<P><PRE>(define (book-load filename) + (load (string-append "/usr/cs3/progs-from-book/" filename))) +</PRE> + +<P>so that students can just say + +<P><PRE>(book-load "functions.scm") +</PRE><P> +<P><A HREF="../ss-toc2.html">(back to Table of Contents)</A><P> +<A HREF="../ssch26/preview.html"><STRONG>BACK</STRONG></A> +chapter thread <A HREF="appendix-cl.html"><STRONG>NEXT</STRONG></A> + +<P> +<ADDRESS> +<A HREF="../index.html">Brian Harvey</A>, +<CODE>bh@cs.berkeley.edu</CODE> +</ADDRESS> +</BODY> +</HTML> diff --git a/js/games/nluqo.github.io/~bh/ssch27/appendix-simply b/js/games/nluqo.github.io/~bh/ssch27/appendix-simply new file mode 100644 index 0000000..9bd8236 --- /dev/null +++ b/js/games/nluqo.github.io/~bh/ssch27/appendix-simply @@ -0,0 +1,14 @@ +\input bkmacs +% \makewide +\appendix{C}{Scheme Initialization File} + +Many of the procedures we talk about in this book aren't part of standard +Scheme; we wrote them ourselves. Here is a listing of the definitions of +those procedures. +\justidx{Scheme, extensions to} +\justidx{extensions to Scheme} + +\bigskip +\listingtiny{simply.scm} + +\bye diff --git a/js/games/nluqo.github.io/~bh/ssch27/appendix-simply.html b/js/games/nluqo.github.io/~bh/ssch27/appendix-simply.html new file mode 100644 index 0000000..7e466a5 --- /dev/null +++ b/js/games/nluqo.github.io/~bh/ssch27/appendix-simply.html @@ -0,0 +1,965 @@ +<P> + +<P><HTML> +<HEAD> +<TITLE>Simply Scheme Appendix C: Scheme Initialization File</TITLE> +</HEAD> +<BODY> +<CITE>Simply Scheme</CITE>: +<CITE>Introducing Computer Science</CITE> 2/e Copyright (C) 1999 MIT +<H2>Appendix C</H2> +<H1>Scheme Initialization File</H1> + +<TABLE width="100%"><TR><TD> +<IMG SRC="../simply.jpg" ALT="cover photo"> +<TD><TABLE> +<TR><TD align="right"><CITE><A HREF="http://www.cs.berkeley.edu/~bh/">Brian +Harvey</A><BR>University of California, Berkeley</CITE> +<TR><TD align="right"><CITE><A HREF="http://ccrma.stanford.edu/~matt">Matthew +Wright</A><BR>University of California, Santa Barbara</CITE> +<TR><TD align="right"><BR> +<TR><TD align="right"><A HREF="../pdf/ssch27.pdf">Download PDF version</A> +<TR><TD align="right"><A HREF="../ss-toc2.html">Back to Table of Contents</A> +<TR><TD align="right"><A HREF="appendix-cl.html"><STRONG>BACK</STRONG></A> +chapter thread <A HREF="appendix-gpl.html"><STRONG>NEXT</STRONG></A> +<TR><TD align="right"><A HREF="http://mitpress.mit.edu/0262082810">MIT +Press web page for <CITE>Simply Scheme</CITE></A> +</TABLE></TABLE> + +<HR> + +<P>Many of the procedures we talk about in this book aren't part of standard +Scheme; we wrote them ourselves. Here is a listing of the definitions of +those procedures. +<A NAME="g15"></A> +<A NAME="g16"></A> + +<P><P><P><PRE> +;;; simply.scm version 3.13 (8/11/98) + +;;; This file uses Scheme features we don't talk about in _Simply_Scheme_. +;;; Read at your own risk. + +(if (equal? 'foo (symbol->string 'foo)) + (error "Simply.scm already loaded!!") + #f) + +;; Make number->string remove leading "+" if necessary + +(if (char=? #\+ (string-ref (number->string 1.0) 0)) + (let ((old-ns number->string) (char=? char=?) (string-ref string-ref) + (substring substring) (string-length string-length)) + (set! number->string + (lambda args + (let ((result (apply old-ns args))) + (if (char=? #\+ (string-ref result 0)) + (substring result 1 (string-length result)) + result))))) + 'no-problem) + +(define number->string + (let ((old-ns number->string) (string? string?)) + (lambda args + (if (string? (car args)) + (car args) + (apply old-ns args))))) + +;; Get strings in error messages to print nicely (especially "") + +(define whoops + (let ((string? string?) (string-append string-append) (error error) + (cons cons) (map map) (apply apply)) + (define (error-printform x) + (if (string? x) + (string-append "\"" x "\"") + x)) + (lambda (string . args) + (apply error (cons string (map error-printform args)))))) + + +;; ROUND returns an inexact integer if its argument is inexact, +;; but we think it should always return an exact integer. +;; (It matters because some Schemes print inexact integers as "+1.0".) +;; The (exact 1) test is for PC Scheme, in which nothing is exact. +(if (and (inexact? (round (sqrt 2))) (exact? 1)) + (let ((old-round round) (inexact->exact inexact->exact)) + (set! round + (lambda (number) + (inexact->exact (old-round number))))) + 'no-problem) + +;; Remainder and quotient blow up if their argument isn't an integer. +;; Unfortunately, in SCM, (* 365.25 24 60 60) *isn't* an integer. + +(if (inexact? (* .25 4)) + (let ((rem remainder) (quo quotient) (inexact->exact inexact->exact) + (integer? integer?)) + (set! remainder + (lambda (x y) + (rem (if (integer? x) (inexact->exact x) x) + (if (integer? y) (inexact->exact y) y)))) + (set! quotient + (lambda (x y) + (quo (if (integer? x) (inexact->exact x) x) + (if (integer? y) (inexact->exact y) y))))) + 'done) + + +;; Random +;; If your version of Scheme has RANDOM, you should take this out. +;; (It gives the same sequence of random numbers every time.) + +(define random + (let ((*seed* 1) (quotient quotient) (modulo modulo) (+ +) (- -) (* *) (> >)) + (lambda (x) + (let* ((hi (quotient *seed* 127773)) + (low (modulo *seed* 127773)) + (test (- (* 16807 low) (* 2836 hi)))) + (if (> test 0) + (set! *seed* test) + (set! *seed* (+ test 2147483647)))) + (modulo *seed* x)))) + + +;;; Logo-style word/sentence implementation + +(define word? + (let ((number? number?) (symbol? symbol?) (string? string?)) + (lambda (x) + (or (symbol? x) (number? x) (string? x))))) + +(define sentence? + (let ((null? null?) (pair? pair?) (word? word?) (car car) (cdr cdr)) + (define (list-of-words? l) + (cond ((null? l) #t) + ((pair? l) + (and (word? (car l)) (list-of-words? (cdr l)))) + (else #f))) + list-of-words?)) + +(define empty? + (let ((null? null?) (string? string?) (string=? string=?)) + (lambda (x) + (or (null? x) + (and (string? x) (string=? x "")))))) + + +(define char-rank + ;; 0 Letter in good case or special initial + ;; 1 ., + or - + ;; 2 Digit + ;; 3 Letter in bad case or weird character + (let ((*the-char-ranks* (make-vector 256 3)) + (= =) (+ +) (string-ref string-ref) (string-length string-length) + (vector-set! vector-set!) (char->integer char->integer) + (symbol->string symbol->string) (vector-ref vector-ref)) + (define (rank-string str rank) + (define (helper i len) + (if (= i len) + 'done + (begin (vector-set! *the-char-ranks* + (char->integer (string-ref str i)) + rank) + (helper (+ i 1) len)))) + (helper 0 (string-length str))) + (rank-string (symbol->string 'abcdefghijklmnopqrstuvwxyz) 0) + (rank-string "!$%&*/:<=>?~_^" 0) + (rank-string "+-." 1) + (rank-string "0123456789" 2) + (lambda (char) ;; value of char-rank + (vector-ref *the-char-ranks* (char->integer char))))) + +(define string->word + (let ((= =) (<= <=) (+ +) (- -) (char-rank char-rank) (string-ref string-ref) + (string-length string-length) (string=? string=?) (not not) + (char=? char=?) (string->number string->number) + (string->symbol string->symbol)) + (lambda (string) + (define (subsequents? string i length) + (cond ((= i length) #t) + ((<= (char-rank (string-ref string i)) 2) + (subsequents? string (+ i 1) length)) + (else #f))) + (define (special-id? string) + (or (string=? string "+") + (string=? string "-") + (string=? string "..."))) + (define (ok-symbol? string) + (if (string=? string "") + #f + (let ((rank1 (char-rank (string-ref string 0)))) + (cond ((= rank1 0) (subsequents? string 1 (string-length string))) + ((= rank1 1) (special-id? string)) + (else #f))))) + + (define (nn-helper string i len seen-point?) + (cond ((= i len) + (if seen-point? + (not (char=? (string-ref string (- len 1)) #\0)) + #t)) + ((char=? #\. (string-ref string i)) + (cond (seen-point? #f) + ((= (+ i 2) len) #t) ; Accepts "23.0" + (else (nn-helper string (+ i 1) len #t)))) + ((= 2 (char-rank (string-ref string i))) + (nn-helper string (+ i 1) len seen-point?)) + (else #f))) + (define (narrow-number? string) + (if (string=? string "") + #f + (let* ((c0 (string-ref string 0)) + (start 0) + (len (string-length string)) + (cn (string-ref string (- len 1)))) + (if (and (char=? c0 #\-) (not (= len 1))) + (begin + (set! start 1) + (set! c0 (string-ref string 1))) + #f) + (cond ((not (= (char-rank cn) 2)) #f) ; Rejects "-" among others + ((char=? c0 #\.) #f) + ((char=? c0 #\0) + (cond ((= len 1) #t) ; Accepts "0" but not "-0" + ((= len 2) #f) ; Rejects "-0" and "03" + ((char=? (string-ref string (+ start 1)) #\.) + (nn-helper string (+ start 2) len #t)) + (else #f))) + (else (nn-helper string start len #f)))))) + + ;; The body of string->word: + (cond ((narrow-number? string) (string->number string)) + ((ok-symbol? string) (string->symbol string)) + (else string))))) + +(define char->word + (let ((= =) (char-rank char-rank) (make-string make-string) (char=? char=?) + (string->symbol string->symbol) (string->number string->number)) + (lambda (char) + (let ((rank (char-rank char)) + (string (make-string 1 char))) + (cond ((= rank 0) (string->symbol string)) + ((= rank 2) (string->number string)) + ((char=? char #\+) '+) + ((char=? char #\-) '-) + (else string)))))) + +(define word->string + (let ((number? number?) (string? string?) (number->string number->string) + (symbol->string symbol->string)) + (lambda (wd) + (cond ((string? wd) wd) + ((number? wd) (number->string wd)) + (else (symbol->string wd)))))) + +(define count + (let ((word? word?) (string-length string-length) + (word->string word->string) (length length)) + (lambda (stuff) + (if (word? stuff) + (string-length (word->string stuff)) + (length stuff))))) + +(define word + (let ((string->word string->word) (apply apply) (string-append string-append) + (map map) (word? word?) (word->string word->string) (whoops whoops)) + (lambda x + (string->word + (apply string-append + (map (lambda (arg) + (if (word? arg) + (word->string arg) + (whoops "Invalid argument to WORD: " arg))) + x)))))) + +(define se + (let ((pair? pair?) (null? null?) (word? word?) (car car) (cons cons) + (cdr cdr) (whoops whoops)) + (define (paranoid-append a original-a b) + (cond ((null? a) b) + ((word? (car a)) + (cons (car a) (paranoid-append (cdr a) original-a b))) + (else (whoops "Argument to SENTENCE not a word or sentence" + original-a )))) + (define (combine-two a b) ;; Note: b is always a list + (cond ((pair? a) (paranoid-append a a b)) + ((null? a) b) + ((word? a) (cons a b)) + (else (whoops "Argument to SENTENCE not a word or sentence:" a)))) + ;; Helper function so recursive calls don't show up in TRACE + (define (real-se args) + (if (null? args) + '() + (combine-two (car args) (real-se (cdr args))))) + (lambda args + (real-se args)))) + +(define sentence se) + +(define first + (let ((pair? pair?) (char->word char->word) (string-ref string-ref) + (word->string word->string) (car car) (empty? empty?) + (whoops whoops) (word? word?)) + (define (word-first wd) + (char->word (string-ref (word->string wd) 0))) + (lambda (x) + (cond ((pair? x) (car x)) + ((empty? x) (whoops "Invalid argument to FIRST: " x)) + ((word? x) (word-first x)) + (else (whoops "Invalid argument to FIRST: " x)))))) + +(define last + (let ((pair? pair?) (- -) (word->string word->string) (char->word char->word) + (string-ref string-ref) (string-length string-length) (empty? empty?) + (cdr cdr) (car car) (whoops whoops) (word? word?)) + (define (word-last wd) + (let ((s (word->string wd))) + (char->word (string-ref s (- (string-length s) 1))))) + (define (list-last lst) + (if (empty? (cdr lst)) + (car lst) + (list-last (cdr lst)))) + (lambda (x) + (cond ((pair? x) (list-last x)) + ((empty? x) (whoops "Invalid argument to LAST: " x)) + ((word? x) (word-last x)) + (else (whoops "Invalid argument to LAST: " x)))))) + +(define bf + (let ((pair? pair?) (substring substring) (string-length string-length) + (string->word string->word) (word->string word->string) (cdr cdr) + (empty? empty?) (whoops whoops) (word? word?)) + (define string-bf + (lambda (s) + (substring s 1 (string-length s)))) + (define (word-bf wd) + (string->word (string-bf (word->string wd)))) + (lambda (x) + (cond ((pair? x) (cdr x)) + ((empty? x) (whoops "Invalid argument to BUTFIRST: " x)) + ((word? x) (word-bf x)) + (else (whoops "Invalid argument to BUTFIRST: " x)))))) + +(define butfirst bf) + +(define bl + (let ((pair? pair?) (- -) (cdr cdr) (cons cons) (car car) (substring substring) + (string-length string-length) (string->word string->word) + (word->string word->string) (empty? empty?) (whoops whoops) (word? word?)) + (define (list-bl list) + (if (null? (cdr list)) + '() + (cons (car list) (list-bl (cdr list))))) + (define (string-bl s) + (substring s 0 (- (string-length s) 1))) + (define (word-bl wd) + (string->word (string-bl (word->string wd)))) + (lambda (x) + (cond ((pair? x) (list-bl x)) + ((empty? x) (whoops "Invalid argument to BUTLAST: " x)) + ((word? x) (word-bl x)) + (else (whoops "Invalid argument to BUTLAST: " x)))))) + +(define butlast bl) + +(define item + (let ((> >) (- -) (< <) (integer? integer?) (list-ref list-ref) + (char->word char->word) (string-ref string-ref) + (word->string word->string) (not not) (whoops whoops) + (count count) (word? word?) (list? list?)) + (define (word-item n wd) + (char->word (string-ref (word->string wd) (- n 1)))) + (lambda (n stuff) + (cond ((not (integer? n)) + (whoops "Invalid first argument to ITEM (must be an integer): " + n)) + ((< n 1) + (whoops "Invalid first argument to ITEM (must be positive): " + n)) + ((> n (count stuff)) + (whoops "No such item: " n stuff)) + ((word? stuff) (word-item n stuff)) + ((list? stuff) (list-ref stuff (- n 1))) + (else (whoops "Invalid second argument to ITEM: " stuff)))))) + +(define equal? + ;; Note that EQUAL? assumes strings are numbers. + ;; (strings-are-numbers #f) doesn't change this behavior. + (let ((vector-length vector-length) (= =) (vector-ref vector-ref) + (+ +) (string? string?) (symbol? symbol?) (null? null?) (pair? pair?) + (car car) (cdr cdr) (eq? eq?) (string=? string=?) + (symbol->string symbol->string) (number? number?) + (string->word string->word) (vector? vector?) (eqv? eqv?)) + (define (vector-equal? v1 v2) + (let ((len1 (vector-length v1)) + (len2 (vector-length v2))) + (define (helper i) + (if (= i len1) + #t + (and (equal? (vector-ref v1 i) (vector-ref v2 i)) + (helper (+ i 1))))) + (if (= len1 len2) + (helper 0) + #f))) + (lambda (x y) + (cond ((null? x) (null? y)) + ((null? y) #f) + ((pair? x) + (and (pair? y) + (equal? (car x) (car y)) + (equal? (cdr x) (cdr y)))) + ((pair? y) #f) + ((symbol? x) + (or (and (symbol? y) (eq? x y)) + (and (string? y) (string=? (symbol->string x) y)))) + ((symbol? y) + (and (string? x) (string=? x (symbol->string y)))) + ((number? x) + (or (and (number? y) (= x y)) + (and (string? y) + (let ((possible-num (string->word y))) + (and (number? possible-num) + (= x possible-num)))))) + ((number? y) + (and (string? x) + (let ((possible-num (string->word x))) + (and (number? possible-num) + (= possible-num y))))) + ((string? x) (and (string? y) (string=? x y))) + ((string? y) #f) + ((vector? x) (and (vector? y) (vector-equal? x y))) + ((vector? y) #f) + (else (eqv? x y)))))) + +(define member? + (let ((> >) (- -) (< <) (null? null?) (symbol? symbol?) (eq? eq?) (car car) + (not not) (symbol->string symbol->string) (string=? string=?) + (cdr cdr) (equal? equal?) (word->string word->string) + (string-length string-length) (whoops whoops) (string-ref string-ref) + (char=? char=?) (list? list?) (number? number?) (empty? empty?) + (word? word?) (string? string?)) + (define (symbol-in-list? symbol string lst) + (cond ((null? lst) #f) + ((and (symbol? (car lst)) + (eq? symbol (car lst)))) + ((string? (car lst)) + (cond ((not string) + (symbol-in-list? symbol (symbol->string symbol) lst)) + ((string=? string (car lst)) #t) + (else (symbol-in-list? symbol string (cdr lst))))) + (else (symbol-in-list? symbol string (cdr lst))))) + (define (word-in-list? wd lst) + (cond ((null? lst) #f) + ((equal? wd (car lst)) #t) + (else (word-in-list? wd (cdr lst))))) + (define (word-in-word? small big) + (let ((one-letter-str (word->string small))) + (if (> (string-length one-letter-str) 1) + (whoops "Invalid arguments to MEMBER?: " small big) + (let ((big-str (word->string big))) + (char-in-string? (string-ref one-letter-str 0) + big-str + (- (string-length big-str) 1)))))) + (define (char-in-string? char string i) + (cond ((< i 0) #f) + ((char=? char (string-ref string i)) #t) + (else (char-in-string? char string (- i 1))))) + (lambda (x stuff) + (cond ((empty? stuff) #f) + ((word? stuff) (word-in-word? x stuff)) + ((not (list? stuff)) + (whoops "Invalid second argument to MEMBER?: " stuff)) + ((symbol? x) (symbol-in-list? x #f stuff)) + ((or (number? x) (string? x)) + (word-in-list? x stuff)) + (else (whoops "Invalid first argument to MEMBER?: " x)))))) + +(define before? + (let ((not not) (word? word?) (whoops whoops) (string<? string<?) + (word->string word->string)) + (lambda (wd1 wd2) + (cond ((not (word? wd1)) + (whoops "Invalid first argument to BEFORE? (not a word): " wd1)) + ((not (word? wd2)) + (whoops "Invalid second argument to BEFORE? (not a word): " wd2)) + (else (string<? (word->string wd1) (word->string wd2))))))) + + +;;; Higher Order Functions + +(define filter + (let ((null? null?) (car car) (cons cons) (cdr cdr) (not not) + (procedure? procedure?) (whoops whoops) (list? list?)) + (lambda (pred l) + ;; Helper function so recursive calls don't show up in TRACE + (define (real-filter l) + (cond ((null? l) '()) + ((pred (car l)) + (cons (car l) (real-filter (cdr l)))) + (else (real-filter (cdr l))))) + (cond ((not (procedure? pred)) + (whoops "Invalid first argument to FILTER (not a procedure): " + pred)) + ((not (list? l)) + (whoops "Invalid second argument to FILTER (not a list): " l)) + (else (real-filter l)))))) + +(define keep + (let ((+ +) (= =) (pair? pair?) (substring substring) + (char->word char->word) (string-ref string-ref) + (string-set! string-set!) (word->string word->string) + (string-length string-length) (string->word string->word) + (make-string make-string) (procedure? procedure?) + (whoops whoops) (word? word?) (null? null?)) + (lambda (pred w-or-s) + (define (keep-string in i out out-len len) + (cond ((= i len) (substring out 0 out-len)) + ((pred (char->word (string-ref in i))) + (string-set! out out-len (string-ref in i)) + (keep-string in (+ i 1) out (+ out-len 1) len)) + (else (keep-string in (+ i 1) out out-len len)))) + (define (keep-word wd) + (let* ((string (word->string wd)) + (len (string-length string))) + (string->word + (keep-string string 0 (make-string len) 0 len)))) + (cond ((not (procedure? pred)) + (whoops "Invalid first argument to KEEP (not a procedure): " + pred)) + ((pair? w-or-s) (filter pred w-or-s)) + ((word? w-or-s) (keep-word w-or-s)) + ((null? w-or-s) '()) + (else + (whoops "Bad second argument to KEEP (not a word or sentence): " + w-or-s)))))) + +(define appearances + (let ((count count) (keep keep) (equal? equal?)) + (lambda (item aggregate) + (count (keep (lambda (element) (equal? item element)) aggregate))))) + +(define every + (let ((= =) (+ +) (se se) (char->word char->word) (string-ref string-ref) + (empty? empty?) (first first) (bf bf) (not not) (procedure? procedure?) + (whoops whoops) (word? word?) (word->string word->string) + (string-length string-length)) + (lambda (fn stuff) + (define (string-every string i length) + (if (= i length) + '() + (se (fn (char->word (string-ref string i))) + (string-every string (+ i 1) length)))) + (define (sent-every sent) + ;; This proc. can't be optimized or else it will break the + ;; exercise where we ask them to reimplement sentences as + ;; vectors and then see if every still works. + (if (empty? sent) + sent ; Can't be '() or exercise breaks. + (se (fn (first sent)) + (sent-every (bf sent))))) + (cond ((not (procedure? fn)) + (whoops "Invalid first argument to EVERY (not a procedure):" + fn)) + ((word? stuff) + (let ((string (word->string stuff))) + (string-every string 0 (string-length string)))) + (else (sent-every stuff)))))) + +(define accumulate + (let ((not not) (empty? empty?) (bf bf) (first first) (procedure? procedure?) + (whoops whoops) (member member) (list list)) + (lambda (combiner stuff) + (define (real-accumulate stuff) + (if (empty? (bf stuff)) + (first stuff) + (combiner (first stuff) (real-accumulate (bf stuff))))) + (cond ((not (procedure? combiner)) + (whoops "Invalid first argument to ACCUMULATE (not a procedure):" + combiner)) + ((not (empty? stuff)) (real-accumulate stuff)) + ((member combiner (list + * word se)) (combiner)) + (else + (whoops "Can't accumulate empty input with that combiner")))))) + +(define reduce + (let ((null? null?) (cdr cdr) (car car) (not not) (procedure? procedure?) + (whoops whoops) (member member) (list list)) + (lambda (combiner stuff) + (define (real-reduce stuff) + (if (null? (cdr stuff)) + (car stuff) + (combiner (car stuff) (real-reduce (cdr stuff))))) + (cond ((not (procedure? combiner)) + (whoops "Invalid first argument to REDUCE (not a procedure):" + combiner)) + ((not (null? stuff)) (real-reduce stuff)) + ((member combiner (list + * word se append)) (combiner)) + (else (whoops "Can't reduce empty input with that combiner")))))) + +(define repeated + (let ((= =) (- -)) + (lambda (fn number) + (if (= number 0) + (lambda (x) x) + (lambda (x) + ((repeated fn (- number 1)) (fn x))))))) + + +;; Tree stuff +(define make-node cons) +(define datum car) +(define children cdr) + + +;; I/O + +(define show + (let ((= =) (length length) (display display) (car car) (newline newline) + (not not) (output-port? output-port?) (apply apply) (whoops whoops)) + (lambda args + (cond + ((= (length args) 1) + (display (car args)) + (newline)) + ((= (length args) 2) + (if (not (output-port? (car (cdr args)))) + (whoops "Invalid second argument to SHOW (not an output port): " + (car (cdr args)))) + (apply display args) + (newline (car (cdr args)))) + (else (whoops "Incorrect number of arguments to procedure SHOW")))))) + +(define show-line + (let ((>= >=) (length length) (whoops whoops) (null? null?) + (current-output-port current-output-port) (car car) (not not) + (list? list?) (display display) (for-each for-each) (cdr cdr) + (newline newline)) + (lambda (line . args) + (if (>= (length args) 2) + (whoops "Too many arguments to show-line") + (let ((port (if (null? args) (current-output-port) (car args)))) + (cond ((not (list? line)) + (whoops "Invalid argument to SHOW-LINE (not a list):" line)) + ((null? line) #f) + (else + (display (car line) port) + (for-each (lambda (wd) (display " " port) (display wd port)) + (cdr line)))) + (newline port)))))) + +(define read-string + (let ((read-char read-char) (eqv? eqv?) (apply apply) + (string-append string-append) (substring substring) (reverse reverse) + (cons cons) (>= >=) (+ +) (string-set! string-set!) (length length) + (whoops whoops) (null? null?) (current-input-port current-input-port) + (car car) (cdr cdr) (eof-object? eof-object?) (list list) + (make-string make-string) (peek-char peek-char)) + (define (read-string-helper chars all-length chunk-length port) + (let ((char (read-char port)) + (string (car chars))) + (cond ((or (eof-object? char) (eqv? char #\newline)) + (apply string-append + (reverse + (cons + (substring (car chars) 0 chunk-length) + (cdr chars))))) + ((>= chunk-length 80) + (let ((newstring (make-string 80))) + (string-set! newstring 0 char) + (read-string-helper (cons newstring chars) + (+ all-length 1) + 1 + port))) + (else + (string-set! string chunk-length char) + (read-string-helper chars + (+ all-length 1) + (+ chunk-length 1) + port))))) + (lambda args + (if (>= (length args) 2) + (whoops "Too many arguments to read-string") + (let ((port (if (null? args) (current-input-port) (car args)))) + (if (eof-object? (peek-char port)) + (read-char port) + (read-string-helper (list (make-string 80)) 0 0 port))))))) + +(define read-line + (let ((= =) (list list) (string->word string->word) (substring substring) + (char-whitespace? char-whitespace?) (string-ref string-ref) + (+ +) (string-length string-length) (apply apply) + (read-string read-string)) + (lambda args + (define (tokenize string) + (define (helper i start len) + (cond ((= i len) + (if (= i start) + '() + (list (string->word (substring string start i))))) + ((char-whitespace? (string-ref string i)) + (if (= i start) + (helper (+ i 1) (+ i 1) len) + (cons (string->word (substring string start i)) + (helper (+ i 1) (+ i 1) len)))) + (else (helper (+ i 1) start len)))) + (if (eof-object? string) + string + (helper 0 0 (string-length string)))) + (tokenize (apply read-string args))))) + +(define *the-open-inports* '()) +(define *the-open-outports* '()) + +(define align + (let ((< <) (abs abs) (* *) (expt expt) (>= >=) (- -) (+ +) (= =) + (null? null?) (car car) (round round) (number->string number->string) + (string-length string-length) (string-append string-append) + (make-string make-string) (substring substring) + (string-set! string-set!) (number? number?) + (word->string word->string)) + (lambda (obj width . rest) + (define (align-number obj width rest) + (let* ((sign (< obj 0)) + (num (abs obj)) + (prec (if (null? rest) 0 (car rest))) + (big (round (* num (expt 10 prec)))) + (cvt0 (number->string big)) + (cvt (if (< num 1) (string-append "0" cvt0) cvt0)) + (pos-str (if (>= (string-length cvt0) prec) + cvt + (string-append + (make-string (- prec (string-length cvt0)) #\0) + cvt))) + (string (if sign (string-append "-" pos-str) pos-str)) + (length (+ (string-length string) + (if (= prec 0) 0 1))) + (left (- length (+ 1 prec))) + (result (if (= prec 0) + string + (string-append + (substring string 0 left) + "." + (substring string left (- length 1)))))) + (cond ((= length width) result) + ((< length width) + (string-append (make-string (- width length) #\space) result)) + (else (let ((new (substring result 0 width))) + (string-set! new (- width 1) #\+) + new))))) + (define (align-word string) + (let ((length (string-length string))) + (cond ((= length width) string) + ((< length width) + (string-append string (make-string (- width length) #\space))) + (else (let ((new (substring string 0 width))) + (string-set! new (- width 1) #\+) + new))))) + (if (number? obj) + (align-number obj width rest) + (align-word (word->string obj)))))) + +(define open-output-file + (let ((oof open-output-file) (cons cons)) + (lambda (filename) + (let ((port (oof filename))) + (set! *the-open-outports* (cons port *the-open-outports*)) + port)))) + +(define open-input-file + (let ((oif open-input-file) (cons cons)) + (lambda (filename) + (let ((port (oif filename))) + (set! *the-open-inports* (cons port *the-open-inports*)) + port)))) + +(define remove! + (let ((null? null?) (cdr cdr) (eq? eq?) (set-cdr! set-cdr!) (car car)) + (lambda (thing lst) + (define (r! prev) + (cond ((null? (cdr prev)) lst) + ((eq? thing (car (cdr prev))) + (set-cdr! prev (cdr (cdr prev))) + lst) + (else (r! (cdr prev))))) + (cond ((null? lst) lst) + ((eq? thing (car lst)) (cdr lst)) + (else (r! lst)))))) + +(define close-input-port + (let ((cip close-input-port) (remove! remove!)) + (lambda (port) + (set! *the-open-inports* (remove! port *the-open-inports*)) + (cip port)))) + +(define close-output-port + (let ((cop close-output-port) (remove! remove!)) + (lambda (port) + (set! *the-open-outports* (remove! port *the-open-outports*)) + (cop port)))) + +(define close-all-ports + (let ((for-each for-each) + (close-input-port close-input-port) + (close-output-port close-output-port)) + (lambda () + (for-each close-input-port *the-open-inports*) + (for-each close-output-port *the-open-outports*) + 'closed))) + +;; Make arithmetic work on numbers in string form: +(define maybe-num + (let ((string? string?) (string->number string->number)) + (lambda (arg) + (if (string? arg) + (let ((num (string->number arg))) + (if num num arg)) + arg)))) + +(define logoize + (let ((apply apply) (map map) (maybe-num maybe-num)) + (lambda (fn) + (lambda args + (apply fn (map maybe-num args)))))) + +;; special case versions of logoize, since (lambda args ...) is expensive +(define logoize-1 + (let ((maybe-num maybe-num)) + (lambda (fn) + (lambda (x) (fn (maybe-num x)))))) + +(define logoize-2 + (let ((maybe-num maybe-num)) + (lambda (fn) + (lambda (x y) (fn (maybe-num x) (maybe-num y)))))) + +(define strings-are-numbers + (let ((are-they? #f) + (real-* *) (real-+ +) (real-- -) (real-/ /) (real-< <) + (real-<= <=) (real-= =) (real-> >) (real->= >=) (real-abs abs) + (real-acos acos) (real-asin asin) (real-atan atan) + (real-ceiling ceiling) (real-cos cos) (real-even? even?) + (real-exp exp) (real-expt expt) (real-floor floor) (real-align align) + (real-gcd gcd) (real-integer? integer?) (real-item item) + (real-lcm lcm) (real-list-ref list-ref) (real-log log) + (real-make-vector make-vector) (real-max max) (real-min min) + (real-modulo modulo) (real-negative? negative?) + (real-number? number?) (real-odd? odd?) (real-positive? positive?) + (real-quotient quotient) (real-random random) (real-remainder remainder) + (real-repeated repeated) (real-round round) (real-sin sin) + (real-sqrt sqrt) (real-tan tan) (real-truncate truncate) + (real-vector-ref vector-ref) (real-vector-set! vector-set!) + (real-zero? zero?) (maybe-num maybe-num) (number->string number->string) + (cons cons) (car car) (cdr cdr) (eq? eq?) (show show) (logoize logoize) + (logoize-1 logoize-1) (logoize-2 logoize-2) (not not) (whoops whoops)) + + (lambda (yesno) + (cond ((and are-they? (eq? yesno #t)) + (show "Strings are already numbers")) + ((eq? yesno #t) + (set! are-they? #t) + (set! * (logoize real-*)) + (set! + (logoize real-+)) + (set! - (logoize real--)) + (set! / (logoize real-/)) + (set! < (logoize real-<)) + (set! <= (logoize real-<=)) + (set! = (logoize real-=)) + (set! > (logoize real->)) + (set! >= (logoize real->=)) + (set! abs (logoize-1 real-abs)) + (set! acos (logoize-1 real-acos)) + (set! asin (logoize-1 real-asin)) + (set! atan (logoize real-atan)) + (set! ceiling (logoize-1 real-ceiling)) + (set! cos (logoize-1 real-cos)) + (set! even? (logoize-1 real-even?)) + (set! exp (logoize-1 real-exp)) + (set! expt (logoize-2 real-expt)) + (set! floor (logoize-1 real-floor)) + (set! align (logoize align)) + (set! gcd (logoize real-gcd)) + (set! integer? (logoize-1 real-integer?)) + (set! item (lambda (n stuff) + (real-item (maybe-num n) stuff))) + (set! lcm (logoize real-lcm)) + (set! list-ref (lambda (lst k) + (real-list-ref lst (maybe-num k)))) + (set! log (logoize-1 real-log)) + (set! max (logoize real-max)) + (set! min (logoize real-min)) + (set! modulo (logoize-2 real-modulo)) + (set! negative? (logoize-1 real-negative?)) + (set! number? (logoize-1 real-number?)) + (set! odd? (logoize-1 real-odd?)) + (set! positive? (logoize-1 real-positive?)) + (set! quotient (logoize-2 real-quotient)) + (set! random (logoize real-random)) + (set! remainder (logoize-2 real-remainder)) + (set! round (logoize-1 real-round)) + (set! sin (logoize-1 real-sin)) + (set! sqrt (logoize-1 real-sqrt)) + + (set! tan (logoize-1 real-tan)) + (set! truncate (logoize-1 real-truncate)) + (set! zero? (logoize-1 real-zero?)) + (set! vector-ref + (lambda (vec i) (real-vector-ref vec (maybe-num i)))) + (set! vector-set! + (lambda (vec i val) + (real-vector-set! vec (maybe-num i) val))) + (set! make-vector + (lambda (num . args) + (apply real-make-vector (cons (maybe-num num) + args)))) + (set! list-ref + (lambda (lst i) (real-list-ref lst (maybe-num i)))) + (set! repeated + (lambda (fn n) (real-repeated fn (maybe-num n))))) + ((and (not are-they?) (not yesno)) + (show "Strings are already not numbers")) + ((not yesno) + (set! are-they? #f) (set! * real-*) (set! + real-+) + (set! - real--) (set! / real-/) (set! < real-<) + (set! <= real-<=) (set! = real-=) (set! > real->) + (set! >= real->=) (set! abs real-abs) (set! acos real-acos) + (set! asin real-asin) (set! atan real-atan) + (set! ceiling real-ceiling) (set! cos real-cos) + (set! even? real-even?) + (set! exp real-exp) (set! expt real-expt) + (set! floor real-floor) (set! align real-align) + (set! gcd real-gcd) (set! integer? real-integer?) + (set! item real-item) + (set! lcm real-lcm) (set! list-ref real-list-ref) + (set! log real-log) (set! max real-max) (set! min real-min) + (set! modulo real-modulo) (set! odd? real-odd?) + (set! quotient real-quotient) (set! random real-random) + (set! remainder real-remainder) (set! round real-round) + (set! sin real-sin) (set! sqrt real-sqrt) (set! tan real-tan) + (set! truncate real-truncate) (set! zero? real-zero?) + (set! positive? real-positive?) (set! negative? real-negative?) + (set! number? real-number?) (set! vector-ref real-vector-ref) + (set! vector-set! real-vector-set!) + (set! make-vector real-make-vector) + (set! list-ref real-list-ref) (set! item real-item) + (set! repeated real-repeated)) + (else (whoops "Strings-are-numbers: give a #t or a #f"))) + are-they?))) + + +;; By default, strings are numbers: +(strings-are-numbers #t) +</PRE><P> + + +<P> +<HR> +<P><A HREF="../ss-toc2.html">(back to Table of Contents)</A><P> +<A HREF="appendix-cl.html"><STRONG>BACK</STRONG></A> +chapter thread <A HREF="appendix-gpl.html"><STRONG>NEXT</STRONG></A> + +<P> +<ADDRESS> +<A HREF="../index.html">Brian Harvey</A>, +<CODE>bh@cs.berkeley.edu</CODE> +</ADDRESS> +</BODY> +</HTML> diff --git a/js/games/nluqo.github.io/~bh/ssch27/appindex.html b/js/games/nluqo.github.io/~bh/ssch27/appindex.html new file mode 100644 index 0000000..0e3f689 --- /dev/null +++ b/js/games/nluqo.github.io/~bh/ssch27/appindex.html @@ -0,0 +1,360 @@ +<HTML> +<HEAD> +<TITLE>Simply Scheme: General Index</TITLE> +</HEAD> +<BODY> +<CITE>Simply Scheme</CITE>: +<CITE>Introducing Computer Science</CITE> 2/e Copyright (C) 1999 MIT +<H1>General Index</H1> + +<TABLE width="100%"><TR><TD> +<IMG SRC="../simply.jpg" ALT="cover photo"> +<TD><TABLE> +<TR><TD align="right"><CITE><A HREF="http://www.cs.berkeley.edu/~bh/">Brian +Harvey</A><BR>University of California, Berkeley</CITE> +<TR><TD align="right"><CITE><A HREF="http://ccrma.stanford.edu/~matt">Matthew +Wright</A><BR>University of California, Santa Barbara</CITE> +<TR><TD align="right"><BR> +<TR><TD align="right"><A HREF="../pdf/ssch27.pdf">Download PDF version</A> +<TR><TD align="right"><A HREF="../ss-toc2.html">Back to Table of Contents</A> +<TR><TD align="right"><A HREF="appuindex.html"><STRONG>BACK</STRONG></A> +chapter thread <A HREF="category.html"><STRONG>NEXT</STRONG></A> +<TR><TD align="right"><A HREF="http://mitpress.mit.edu/0262082810">MIT +Press web page for <CITE>Simply Scheme</CITE></A> +</TABLE></TABLE> + +<HR> + + +<P>This index contains technical terms and primitive procedures. Other sources +of information are the index of defined procedures, which contains +procedures whose definitions are in the text and procedures that you are +asked to write as exercises; the glossary, which defines many technical +terms; and the Alphabetical Table of Scheme Primitives on page <A HREF="appendix-funlist.html#funlist">funlist</A>. + +<P><BR> +<A HREF="appindex.html#A">A</A> <A HREF="appindex.html#B">B</A> <A HREF="appindex.html#C">C</A> <A HREF="appindex.html#D">D</A> <A HREF="appindex.html#E">E</A> <A HREF="appindex.html#F">F</A> <A HREF="appindex.html#G">G</A> <A HREF="appindex.html#H">H</A> <A HREF="appindex.html#I">I</A> J <A HREF="appindex.html#K">K</A> <A HREF="appindex.html#L">L</A> <A HREF="appindex.html#M">M</A> <A HREF="appindex.html#N">N</A> <A HREF="appindex.html#O">O</A> <A HREF="appindex.html#P">P</A> <A HREF="appindex.html#Q">Q</A> <A HREF="appindex.html#R">R</A> <A HREF="appindex.html#S">S</A> <A HREF="appindex.html#T">T</A> <A HREF="appindex.html#U">U</A> <A HREF="appindex.html#V">V</A> <A HREF="appindex.html#W">W</A> X Y Z + +<P><BR> +<CODE>#f</CODE> <A HREF="../ssch6/true#g66">Ch6</A><BR> +<CODE>#t</CODE> <A HREF="../ssch6/true#g65">Ch6</A><BR> +<CODE>'</CODE> <A HREF="../ssch5/words#g5">Ch5</A><BR> +<CODE>*</CODE> <A HREF="appendix-funlist#g202">FunList</A><BR> +<CODE>+</CODE> <A HREF="appendix-funlist#g203">FunList</A><BR> +<CODE>-</CODE> <A HREF="../ssch6/true#g83">Ch6</A>, <A HREF="appendix-funlist#g204">FunList</A><BR> +<CODE>/</CODE> <A HREF="appendix-funlist#g205">FunList</A><BR> +<CODE><</CODE> <A HREF="../ssch6/true#g73">Ch6</A><BR> +<CODE><=</CODE> <A HREF="../ssch6/true#g75">Ch6</A><BR> +<CODE>=</CODE> <A HREF="../ssch6/true#g71">Ch6</A><BR> +<CODE>></CODE> <A HREF="../ssch6/true#g72">Ch6</A><BR> +<CODE>>=</CODE> <A HREF="../ssch6/true#g74">Ch6</A><BR> +<A NAME="A"></A> +Abelson, Harold <A HREF="../ssch13/convince-recur#g2">Ch13</A>, <A HREF="../ssch26/preview#g2">Ch26</A><BR> +<CODE>abs</CODE> <A HREF="../ssch6/true#g84">Ch6</A><BR> +abstract data type <A HREF="../ssch16/match#g13">Ch16</A>, <A HREF="../ssch17/lists#g15">Ch17</A>, <A HREF="../ssch18/trees#g28">Ch18</A>, <A HREF="../ssch25/spread-implement#g3">Ch25</A><BR> +<CODE>accumulate</CODE> <A HREF="../ssch8/higher#g20">Ch8</A>, <A HREF="../ssch8/higher#g29">Ch8</A>, <A HREF="../ssch19/implement-hof#g14">Ch19</A><BR> +actual argument <A HREF="../ssch4/defining#g10">Ch4</A><BR> +actual argument expression <A HREF="../ssch4/defining#g12">Ch4</A><BR> +actual argument value <A HREF="../ssch4/defining#g14">Ch4</A><BR> +ADT <A HREF="../ssch16/match#g16">Ch16</A>, <A HREF="../ssch18/trees#g31">Ch18</A>, <A HREF="../ssch25/spread-implement#g2">Ch25</A><BR> +<CODE>align</CODE> <A HREF="../ssch20/io#g44">Ch20</A><BR> +<CODE>and</CODE> <A HREF="../ssch6/true#g87">Ch6</A>, <A HREF="../ssch6/true#g96">Ch6</A><BR> +<CODE>append</CODE> <A HREF="../ssch17/lists#g9">Ch17</A><BR> +<CODE>apply</CODE> <A HREF="../ssch17/lists#g38">Ch17</A><BR> +argument, actual <A HREF="../ssch4/defining#g11">Ch4</A><BR> +arguments, variable number of <A HREF="../ssch17/lists#g36">Ch17</A><BR> +arithmetic function <A HREF="../ssch2/functions#g3">Ch2</A><BR> +<CODE>assoc</CODE> <A HREF="../ssch17/lists#g33">Ch17</A><BR> +association list <A HREF="../ssch17/lists#g31">Ch17</A><BR> +atomic expression <A HREF="../ssch3/people#g1">Ch3</A><BR> +<A NAME="B"></A> +base case <A HREF="../ssch11/recursion#g5">Ch11</A><BR> +base cases, simplifying <A HREF="../ssch12/leap#g5">Ch12</A><BR> +<CODE>before?</CODE> <A HREF="../ssch6/true#g76">Ch6</A><BR> +<CODE>begin</CODE> <A HREF="../ssch20/io#g18">Ch20</A><BR> +<CODE>bf</CODE> <A HREF="../ssch5/words#g20">Ch5</A><BR> +binary number <A HREF="../ssch15/adv-recur#g4">Ch15</A><BR> +<CODE>bl</CODE> <A HREF="../ssch5/words#g21">Ch5</A><BR> +Bonne, Rose <A HREF="credits#g39">Credits</A><BR> +<CODE>boolean?</CODE> <A HREF="../ssch6/true#g79">Ch6</A><BR> +Boole, George <A HREF="../ssch2/functions#g5">Ch2</A><BR> +branch node <A HREF="../ssch18/trees#g3">Ch18</A><BR> +bridge points <A HREF="../ssch9/bridge#g1">ProjBridge</A><BR> +<CODE>butfirst</CODE> <A HREF="../ssch5/words#g10">Ch5</A><BR> +<CODE>butlast</CODE> <A HREF="../ssch5/words#g12">Ch5</A><BR> +<A NAME="C"></A> +<CODE>cadr</CODE> <A HREF="../ssch17/lists#g14">Ch17</A><BR> +<CODE>car</CODE> <A HREF="../ssch17/lists#g4">Ch17</A><BR> +Carroll, Lewis <A HREF="../ssch4/defining#g7">Ch4</A>, <A HREF="credits#g37">Credits</A><BR> +case, base <A HREF="../ssch11/recursion#g6">Ch11</A><BR> +case, recursive <A HREF="../ssch11/recursion#g4">Ch11</A><BR> +<CODE>cdr</CODE> <A HREF="../ssch17/lists#g5">Ch17</A><BR> +<CODE>ceiling</CODE> <A HREF="appendix-funlist#g206">FunList</A><BR> +chalkboard model <A HREF="../ssch7/variables#g8">Ch7</A><BR> +child (in spreadsheet program) <A HREF="../ssch25/spread-implement#g22">Ch25</A><BR> +<CODE>children</CODE> <A HREF="../ssch18/trees#g9">Ch18</A><BR> +clause, cond <A HREF="../ssch6/true#g105">Ch6</A><BR> +Clinger, William <A HREF="../ssch22/files#g26">Ch22</A><BR> +<CODE>close-all-ports</CODE> <A HREF="../ssch22/files#g39">Ch22</A><BR> +<CODE>close-input-port</CODE> <A HREF="../ssch22/files#g13">Ch22</A><BR> +<CODE>close-output-port</CODE> <A HREF="../ssch22/files#g11">Ch22</A><BR> +complexity, control of <A HREF="../ssch1/showing#g2">Ch1</A><BR> +composition of functions <A HREF="../ssch3/part2#g1">Part2</A>, <A HREF="../ssch4/defining#g18">Ch4</A><BR> +compound expression <A HREF="../ssch3/people#g3">Ch3</A>, <A HREF="../ssch3/people#g7">Ch3</A><BR> +compound procedure <A HREF="../ssch1/showing#g9">Ch1</A><BR> +computing, symbolic <A HREF="../ssch1/showing#g22">Ch1</A><BR> +cond clause <A HREF="../ssch6/true#g104">Ch6</A><BR> +<CODE>cond</CODE> <A HREF="../ssch6/true#g101">Ch6</A>, <A HREF="../ssch10/ttt#g10">Ch10</A>, <A HREF="../ssch20/io#g15">Ch20</A><BR> +<CODE>cons</CODE> <A HREF="../ssch17/lists#g8">Ch17</A><BR> +constant, named <A HREF="../ssch7/variables#g3">Ch7</A><BR> +control of complexity <A HREF="../ssch1/showing#g1">Ch1</A><BR> +conversational program <A HREF="../ssch20/io#g1">Ch20</A><BR> +<CODE>cos</CODE> <A HREF="appendix-funlist#g207">FunList</A><BR> +<CODE>count</CODE> <A HREF="../ssch8/higher#g23">Ch8</A><BR> +<CODE>c...r</CODE> <A HREF="../ssch17/lists#g13">Ch17</A><BR> +<A NAME="D"></A> +data file <A HREF="../ssch22/files#g7">Ch22</A><BR> +data structure <A HREF="../ssch10/ttt#g2">Ch10</A><BR> +data type, abstract <A HREF="../ssch16/match#g14">Ch16</A>, <A HREF="../ssch17/lists#g16">Ch17</A>, <A HREF="../ssch18/trees#g29">Ch18</A>, <A HREF="../ssch25/spread-implement#g4">Ch25</A><BR> +<CODE>datum</CODE> <A HREF="../ssch18/trees#g8">Ch18</A><BR> +<CODE>define</CODE> <A HREF="../ssch4/defining#g2">Ch4</A>, <A HREF="../ssch9/lambda#g10">Ch9</A><BR> +definition, global <A HREF="../ssch9/lambda#g14">Ch9</A><BR> +diagram, plumbing <A HREF="../ssch3/people#g15">Ch3</A>, <A HREF="../ssch3/people#g19">Ch3</A><BR> +<CODE>display</CODE> <A HREF="../ssch20/io#g21">Ch20</A>, <A HREF="../ssch22/files#g3">Ch22</A><BR> +Dodgson, Charles <A HREF="credits#g38">Credits</A><BR> +<A NAME="E"></A> +effect, side <A HREF="../ssch20/io#g10">Ch20</A><BR> +<CODE>else</CODE> <A HREF="../ssch6/true#g106">Ch6</A><BR> +<CODE>empty?</CODE> <A HREF="../ssch6/true#g77">Ch6</A><BR> +empty sentence <A HREF="../ssch5/words#g14">Ch5</A>, <A HREF="../ssch6/true#g67">Ch6</A><BR> +end-of-file object <A HREF="../ssch22/files#g16">Ch22</A><BR> +<CODE>eof-object?</CODE> <A HREF="../ssch22/files#g19">Ch22</A><BR> +<CODE>equal?</CODE> <A HREF="../ssch6/true#g69">Ch6</A><BR> +<CODE>error</CODE> <A HREF="appendix-funlist#g208">FunList</A><BR> +error messages <A HREF="../ssch1/showing#g4">Ch1</A><BR> +<CODE>eval</CODE> <A HREF="../ssch25/spread-implement#g28">Ch25</A><BR> +evaluation, order of <A HREF="../ssch3/people#g8">Ch3</A>, <A HREF="../ssch3/people#g12">Ch3</A><BR> +<CODE>even?</CODE> <A HREF="appendix-funlist#g209">FunList</A><BR> +<CODE>every</CODE> <A HREF="../ssch8/higher#g3">Ch8</A>, <A HREF="../ssch8/higher#g27">Ch8</A><BR> +exclusive, mutually <A HREF="../ssch6/true#g109">Ch6</A><BR> +<CODE>exit</CODE> <A HREF="../ssch1/showing#g5">Ch1</A><BR> +expression, actual argument <A HREF="../ssch4/defining#g13">Ch4</A><BR> +expression, atomic <A HREF="../ssch3/people#g2">Ch3</A>, <A HREF="../ssch3/people#g6">Ch3</A><BR> +expression, compound <A HREF="../ssch3/people#g4">Ch3</A>, <A HREF="../ssch3/people#g8">Ch3</A><BR> +expression, self-evaluating <A HREF="../ssch3/people#g5">Ch3</A>, <A HREF="../ssch3/people#g9">Ch3</A>, <A HREF="../ssch5/words#g17">Ch5</A>, <A HREF="../ssch5/words#g26">Ch5</A><BR> +<CODE>expt</CODE> <A HREF="appendix-funlist#g210">FunList</A><BR> +extensions to Scheme <A HREF="../ssch5/words#g8">Ch5</A>, <A HREF="appendix-simply#g16">InitFile</A><BR> +<A NAME="F"></A> +Fibonacci numbers <A HREF="../ssch13/convince-recur#g12">Ch13</A><BR> +file, data <A HREF="../ssch22/files#g8">Ch22</A><BR> +<CODE>file-map</CODE> <A HREF="../ssch22/files#g20">Ch22</A><BR> +<CODE>filter</CODE> <A HREF="../ssch17/lists#g25">Ch17</A>, <A HREF="../ssch19/implement-hof#g12">Ch19</A><BR> +<CODE>first</CODE> <A HREF="../ssch5/words#g9">Ch5</A><BR> +<CODE>floor</CODE> <A HREF="appendix-funlist#g211">FunList</A><BR> +<CODE>for-each</CODE> <A HREF="../ssch20/io#g26">Ch20</A><BR> +formal parameter <A HREF="../ssch4/defining#g8">Ch4</A><BR> +form, special <A HREF="../ssch4/defining#g4">Ch4</A>, <A HREF="../ssch5/words#g4">Ch5</A>, <A HREF="../ssch6/true#g100">Ch6</A>, <A HREF="../ssch6/true#g92">Ch6</A>, <A HREF="../ssch6/true#g95">Ch6</A>, <A HREF="../ssch7/variables#g15">Ch7</A>, <A HREF="../ssch9/lambda#g5">Ch9</A>, <A HREF="../ssch13/convince-recur#g17">Ch13</A>, <A HREF="../ssch20/io#g17">Ch20</A><BR> +Freud, Sigmund <A HREF="../ssch26/preview#g5">Ch26</A><BR> +Friedman, Daniel P. <A HREF="../ssch23/vectors#g1">Ch23</A><BR> +functional programming <A HREF="../ssch2/functions#g1">Ch2</A>, <A HREF="../ssch3/part2#g3">Part2</A>, <A HREF="../ssch7/variables#g4">Ch7</A>, <A HREF="../ssch20/io#g19">Ch20</A><BR> +function, arithmetic <A HREF="../ssch2/functions#g4">Ch2</A><BR> +function as argument <A HREF="../ssch8/higher#g5">Ch8</A><BR> +function as data <A HREF="../ssch2/functions#g6">Ch2</A><BR> +function composition <A HREF="../ssch3/part2#g2">Part2</A>, <A HREF="../ssch4/defining#g19">Ch4</A><BR> +function, higher-order <A HREF="../ssch2/functions#g8">Ch2</A>, <A HREF="../ssch8/higher#g13">Ch8</A>, <A HREF="../ssch17/lists#g23">Ch17</A>, <A HREF="../ssch19/implement-hof#g3">Ch19</A><BR> +function machine <A HREF="../ssch3/people#g12">Ch3</A>, <A HREF="../ssch3/people#g16">Ch3</A>, <A HREF="../ssch8/higher#g14">Ch8</A><BR> +<CODE>functions</CODE> <A HREF="../ssch21/functions-implement#g1">Ch21</A><BR> +function, unnamed <A HREF="../ssch9/lambda#g17">Ch9</A><BR> +function vs. procedure <A HREF="../ssch4/defining#g6">Ch4</A>, <A HREF="../ssch8/higher#g8">Ch8</A><BR> +<A NAME="G"></A> +generalization <A HREF="../ssch4/defining#g16">Ch4</A>, <A HREF="../ssch19/implement-hof#g4">Ch19</A>, <A HREF="../ssch22/files#g23">Ch22</A><BR> +global variable <A HREF="../ssch9/lambda#g12">Ch9</A><BR> +<A NAME="H"></A> +Harvey, Brian <A HREF="../ssch13/convince-recur#g5">Ch13</A><BR> +helper procedure <A HREF="../ssch14/recur-patterns#g15">Ch14</A><BR> +higher-order function <A HREF="../ssch2/functions#g7">Ch2</A>, <A HREF="../ssch8/higher#g12">Ch8</A>, <A HREF="../ssch17/lists#g22">Ch17</A>, <A HREF="../ssch19/implement-hof#g2">Ch19</A><BR> +<A NAME="I"></A> +<CODE>if</CODE> <A HREF="../ssch6/true#g64">Ch6</A>, <A HREF="../ssch6/true#g90">Ch6</A><BR> +imperative programming <A HREF="../ssch23/vectors#g18">Ch23</A><BR> +indentation <A HREF="../ssch1/showing#g17">Ch1</A>, <A HREF="../ssch3/people#g16">Ch3</A><BR> +infix notation <A HREF="../ssch18/trees#g33">Ch18</A><BR> +initialization procedure <A HREF="../ssch14/recur-patterns#g19">Ch14</A><BR> +<CODE>integer?</CODE> <A HREF="appendix-funlist#g212">FunList</A><BR> +interactive programming <A HREF="../ssch20/io#g3">Ch20</A><BR> +interface, user <A HREF="../ssch20/io#g47">Ch20</A><BR> +<CODE>item</CODE> <A HREF="../ssch8/higher#g32">Ch8</A><BR> +<A NAME="K"></A> +<CODE>keep</CODE> <A HREF="../ssch8/higher#g16">Ch8</A>, <A HREF="../ssch8/higher#g28">Ch8</A><BR> +<CODE>keep</CODE> pattern <A HREF="../ssch14/recur-patterns#g5">Ch14</A><BR> +<A NAME="L"></A> +<CODE>lambda</CODE> <A HREF="../ssch9/lambda#g1">Ch9</A><BR> +<CODE>last</CODE> <A HREF="../ssch5/words#g11">Ch5</A><BR> +Latin, Pig <A HREF="../ssch1/showing#g14">Ch1</A>, <A HREF="../ssch11/recursion#g8">Ch11</A><BR> +leaf node <A HREF="../ssch18/trees#g5">Ch18</A><BR> +<CODE>length</CODE> <A HREF="../ssch17/lists#g30">Ch17</A><BR> +<CODE>let</CODE> <A HREF="../ssch7/variables#g13">Ch7</A><BR> +lines of a program <A HREF="../ssch1/showing#g16">Ch1</A><BR> +list, association <A HREF="../ssch17/lists#g32">Ch17</A><BR> +<CODE>list</CODE> <A HREF="../ssch17/lists#g7">Ch17</A><BR> +<CODE>list?</CODE> <A HREF="../ssch17/lists#g27">Ch17</A><BR> +<CODE>list->vector</CODE> <A HREF="../ssch23/vectors#g9">Ch23</A><BR> +<CODE>list-ref</CODE> <A HREF="../ssch17/lists#g29">Ch17</A><BR> +list, structured <A HREF="../ssch17/lists#g2">Ch17</A>, <A HREF="../ssch19/implement-hof#g20">Ch19</A><BR> +little people <A HREF="../ssch7/variables#g6">Ch7</A>, <A HREF="../ssch13/convince-recur#g1">Ch13</A><BR> +<CODE>load</CODE> <A HREF="appendix-funlist#g213">FunList</A><BR> +local variable <A HREF="../ssch7/variables#g10">Ch7</A><BR> +<CODE>log</CODE> <A HREF="appendix-funlist#g214">FunList</A><BR> +<A NAME="M"></A> +machine, function <A HREF="../ssch3/people#g13">Ch3</A>, <A HREF="../ssch3/people#g17">Ch3</A>, <A HREF="../ssch8/higher#g15">Ch8</A><BR> +<CODE>make-node</CODE> <A HREF="../ssch18/trees#g7">Ch18</A><BR> +<CODE>make-vector</CODE> <A HREF="../ssch23/vectors#g2">Ch23</A><BR> +Manilow, Barry <A HREF="../ssch5/words#g1">Ch5</A><BR> +<CODE>map</CODE> <A HREF="../ssch17/lists#g24">Ch17</A><BR> +Marx, Karl <A HREF="../ssch26/preview#g6">Ch26</A><BR> +matcher, pattern <A HREF="../ssch16/match#g2">Ch16</A><BR> +<CODE>max</CODE> <A HREF="appendix-funlist#g215">FunList</A><BR> +<CODE>member</CODE> <A HREF="../ssch17/lists#g28">Ch17</A><BR> +<CODE>member?</CODE> <A HREF="../ssch6/true#g70">Ch6</A>, <A HREF="../ssch6/true#g110">Ch6</A><BR> +Mills, Alan <A HREF="credits#g40">Credits</A><BR> +<CODE>min</CODE> <A HREF="appendix-funlist#g216">FunList</A><BR> +model, chalkboard <A HREF="../ssch7/variables#g9">Ch7</A><BR> +moon, phase of the <A HREF="../ssch13/convince-recur#g11">Ch13</A><BR> +mutually exclusive <A HREF="../ssch6/true#g108">Ch6</A><BR> +mutual recursion <A HREF="../ssch18/trees#g16">Ch18</A><BR> +<A NAME="N"></A> +named constant <A HREF="../ssch7/variables#g2">Ch7</A><BR> +naming a value <A HREF="../ssch7/variables#g1">Ch7</A>, <A HREF="../ssch9/lambda#g9">Ch9</A><BR> +<CODE>newline</CODE> <A HREF="../ssch20/io#g23">Ch20</A>, <A HREF="../ssch22/files#g6">Ch22</A><BR> +node, branch <A HREF="../ssch18/trees#g4">Ch18</A><BR> +node, leaf <A HREF="../ssch18/trees#g6">Ch18</A><BR> +node, root <A HREF="../ssch18/trees#g2">Ch18</A><BR> +<CODE>not</CODE> <A HREF="../ssch6/true#g88">Ch6</A><BR> +<CODE>null?</CODE> <A HREF="../ssch17/lists#g6">Ch17</A><BR> +number, binary <A HREF="../ssch15/adv-recur#g5">Ch15</A><BR> +<CODE>number?</CODE> <A HREF="../ssch6/true#g78">Ch6</A><BR> +numbers, Fibonacci <A HREF="../ssch13/convince-recur#g13">Ch13</A><BR> +<A NAME="O"></A> +object, end-of-file <A HREF="../ssch22/files#g17">Ch22</A><BR> +<CODE>odd?</CODE> <A HREF="appendix-funlist#g217">FunList</A><BR> +<CODE>open-input-file</CODE> <A HREF="../ssch22/files#g12">Ch22</A><BR> +<CODE>open-output-file</CODE> <A HREF="../ssch22/files#g9">Ch22</A><BR> +<CODE>or</CODE> <A HREF="../ssch6/true#g93">Ch6</A><BR> +order of evaluation <A HREF="../ssch3/people#g7">Ch3</A>, <A HREF="../ssch3/people#g11">Ch3</A><BR> +<A NAME="P"></A> +parameter, formal <A HREF="../ssch4/defining#g9">Ch4</A><BR> +parameter, rest <A HREF="../ssch17/lists#g40">Ch17</A><BR> +parentheses, for cond clauses <A HREF="../ssch6/true#g103">Ch6</A><BR> +parentheses, for let variables <A HREF="../ssch7/variables#g17">Ch7</A><BR> +parentheses, for procedure invocation <A HREF="../ssch1/showing#g3">Ch1</A>, <A HREF="../ssch3/people#g9">Ch3</A>, <A HREF="../ssch3/people#g13">Ch3</A>, <A HREF="../ssch8/higher#g37">Ch8</A><BR> +parent (in spreadsheet program) <A HREF="../ssch25/spread-implement#g21">Ch25</A><BR> +pattern: <CODE>keep</CODE> <A HREF="../ssch14/recur-patterns#g6">Ch14</A><BR> +pattern matcher <A HREF="../ssch16/match#g1">Ch16</A><BR> +pattern, recursive <A HREF="../ssch14/recur-patterns#g2">Ch14</A><BR> +phase of the moon <A HREF="../ssch13/convince-recur#g10">Ch13</A><BR> +Pig Latin <A HREF="../ssch1/showing#g13">Ch1</A>, <A HREF="../ssch11/recursion#g7">Ch11</A><BR> +Pisano, Leonardo <A HREF="../ssch13/convince-recur#g14">Ch13</A><BR> +plumbing diagram <A HREF="../ssch3/people#g14">Ch3</A>, <A HREF="../ssch3/people#g18">Ch3</A><BR> +points, bridge <A HREF="../ssch9/bridge#g2">ProjBridge</A><BR> +prefix notation <A HREF="../ssch18/trees#g32">Ch18</A><BR> +primitive procedure <A HREF="../ssch1/showing#g7">Ch1</A><BR> +printed twice, return value <A HREF="../ssch13/convince-recur#g8">Ch13</A><BR> +printing <A HREF="../ssch20/io#g5">Ch20</A>, <A HREF="../ssch20/io#g50">Ch20</A><BR> +procedure as argument <A HREF="../ssch8/higher#g6">Ch8</A><BR> +procedure, compound <A HREF="../ssch1/showing#g8">Ch1</A><BR> +procedure, helper <A HREF="../ssch14/recur-patterns#g16">Ch14</A><BR> +procedure, higher-order <A HREF="../ssch19/implement-hof#g1">Ch19</A><BR> +procedure, initialization <A HREF="../ssch14/recur-patterns#g20">Ch14</A><BR> +procedure, primitive <A HREF="../ssch1/showing#g6">Ch1</A><BR> +<CODE>procedure?</CODE> <A HREF="appendix-funlist#g218">FunList</A><BR> +procedure vs. function <A HREF="../ssch4/defining#g5">Ch4</A>, <A HREF="../ssch8/higher#g7">Ch8</A><BR> +program, conversational <A HREF="../ssch20/io#g2">Ch20</A><BR> +programming, functional <A HREF="../ssch2/functions#g2">Ch2</A>, <A HREF="../ssch3/part2#g4">Part2</A>, <A HREF="../ssch7/variables#g5">Ch7</A>, <A HREF="../ssch20/io#g20">Ch20</A><BR> +programming, imperative <A HREF="../ssch23/vectors#g19">Ch23</A><BR> +programming, interactive <A HREF="../ssch20/io#g4">Ch20</A><BR> +programming, symbolic <A HREF="../ssch1/showing#g24">Ch1</A><BR> +<A NAME="Q"></A> +quotation marks, double <A HREF="../ssch5/words#g6">Ch5</A><BR> +<CODE>quote</CODE> <A HREF="../ssch5/words#g2">Ch5</A><BR> +<CODE>quotient</CODE> <A HREF="appendix-funlist#g219">FunList</A><BR> +<A NAME="R"></A> +<CODE>random</CODE> <A HREF="../ssch23/vectors#g7">Ch23</A>, <A HREF="appendix-funlist#g220">FunList</A><BR> +<CODE>read</CODE> <A HREF="../ssch20/io#g35">Ch20</A>, <A HREF="../ssch22/files#g1">Ch22</A><BR> +<CODE>read-line</CODE> <A HREF="../ssch20/io#g41">Ch20</A>, <A HREF="../ssch22/files#g2">Ch22</A><BR> +<CODE>read-string</CODE> <A HREF="../ssch22/files#g33">Ch22</A><BR> +recursion <EM>see</EM> recursion<BR> +recursion, mutual <A HREF="../ssch18/trees#g17">Ch18</A><BR> +recursion, tree <A HREF="../ssch18/trees#g19">Ch18</A><BR> +recursive case <A HREF="../ssch11/recursion#g3">Ch11</A><BR> +recursive pattern <A HREF="../ssch14/recur-patterns#g1">Ch14</A><BR> +<CODE>reduce</CODE> <A HREF="../ssch17/lists#g26">Ch17</A>, <A HREF="../ssch19/implement-hof#g15">Ch19</A><BR> +Rees, Jonathan <A HREF="../ssch22/files#g27">Ch22</A><BR> +<CODE>remainder</CODE> <A HREF="appendix-funlist#g221">FunList</A><BR> +<CODE>repeated</CODE> <A HREF="../ssch8/higher#g30">Ch8</A><BR> +replacement, result <A HREF="../ssch3/people#g11">Ch3</A>, <A HREF="../ssch3/people#g15">Ch3</A><BR> +rest parameter <A HREF="../ssch17/lists#g39">Ch17</A><BR> +result replacement <A HREF="../ssch3/people#g10">Ch3</A>, <A HREF="../ssch3/people#g14">Ch3</A><BR> +root node <A HREF="../ssch18/trees#g1">Ch18</A><BR> +<CODE>round</CODE> <A HREF="appendix-funlist#g222">FunList</A><BR> +<A NAME="S"></A> +Scheme, extensions to <A HREF="../ssch5/words#g7">Ch5</A>, <A HREF="appendix-simply#g15">InitFile</A><BR> +<CODE>se</CODE> <A HREF="../ssch5/words#g24">Ch5</A><BR> +self-evaluating expression <A HREF="../ssch3/people#g6">Ch3</A>, <A HREF="../ssch3/people#g10">Ch3</A>, <A HREF="../ssch5/words#g18">Ch5</A>, <A HREF="../ssch5/words#g25">Ch5</A><BR> +<CODE>sentence</CODE> <A HREF="../ssch5/words#g23">Ch5</A><BR> +<CODE>sentence?</CODE> <A HREF="../ssch6/true#g81">Ch6</A><BR> +sentence, empty <A HREF="../ssch5/words#g15">Ch5</A>, <A HREF="../ssch6/true#g68">Ch6</A><BR> +<CODE>show</CODE> <A HREF="../ssch20/io#g6">Ch20</A>, <A HREF="../ssch22/files#g4">Ch22</A>, <A HREF="../ssch22/files#g10">Ch22</A><BR> +<CODE>show-line</CODE> <A HREF="../ssch20/io#g42">Ch20</A>, <A HREF="../ssch22/files#g5">Ch22</A><BR> +side effect <A HREF="../ssch20/io#g9">Ch20</A><BR> +simplifying base cases <A HREF="../ssch12/leap#g4">Ch12</A><BR> +<CODE>sin</CODE> <A HREF="appendix-funlist#g223">FunList</A><BR> +special form <A HREF="../ssch4/defining#g3">Ch4</A>, <A HREF="../ssch5/words#g3">Ch5</A>, <A HREF="../ssch6/true#g91">Ch6</A>, <A HREF="../ssch6/true#g94">Ch6</A>, <A HREF="../ssch6/true#g99">Ch6</A>, <A HREF="../ssch7/variables#g14">Ch7</A>, <A HREF="../ssch9/lambda#g4">Ch9</A>, <A HREF="../ssch13/convince-recur#g16">Ch13</A>, <A HREF="../ssch20/io#g16">Ch20</A><BR> +<CODE>sqrt</CODE> <A HREF="appendix-funlist#g224">FunList</A><BR> +string <A HREF="../ssch5/words#g19">Ch5</A><BR> +<EM>Structure and Interpretation of Computer Programs</EM> <A HREF="../ssch26/preview#g1">Ch26</A><BR> +structure, data <A HREF="../ssch10/ttt#g3">Ch10</A><BR> +structured list <A HREF="../ssch17/lists#g3">Ch17</A>, <A HREF="../ssch19/implement-hof#g19">Ch19</A><BR> +substitution <A HREF="../ssch7/variables#g12">Ch7</A><BR> +substitution model and global variables <A HREF="../ssch9/lambda#g11">Ch9</A><BR> +Sussman, Gerald Jay <A HREF="../ssch13/convince-recur#g3">Ch13</A>, <A HREF="../ssch26/preview#g3">Ch26</A><BR> +Sussman, Julie <A HREF="../ssch13/convince-recur#g4">Ch13</A>, <A HREF="../ssch26/preview#g4">Ch26</A><BR> +symbolic programming <A HREF="../ssch1/showing#g23">Ch1</A><BR> +<A NAME="T"></A> +<CODE>trace</CODE> <A HREF="../ssch13/convince-recur#g7">Ch13</A><BR> +tree recursion <A HREF="../ssch18/trees#g18">Ch18</A><BR> +type, abstract <A HREF="../ssch16/match#g15">Ch16</A>, <A HREF="../ssch17/lists#g17">Ch17</A>, <A HREF="../ssch18/trees#g30">Ch18</A>, <A HREF="../ssch25/spread-implement#g1">Ch25</A><BR> +<A NAME="U"></A> +unnamed function <A HREF="../ssch9/lambda#g18">Ch9</A><BR> +<CODE>untrace</CODE> <A HREF="../ssch13/convince-recur#g9">Ch13</A><BR> +user interface <A HREF="../ssch20/io#g46">Ch20</A><BR> +<A NAME="V"></A> +value, actual argument <A HREF="../ssch4/defining#g15">Ch4</A><BR> +variable, global <A HREF="../ssch9/lambda#g13">Ch9</A><BR> +variable, local <A HREF="../ssch7/variables#g11">Ch7</A><BR> +variable number of arguments <A HREF="../ssch17/lists#g35">Ch17</A><BR> +<CODE>vector</CODE> <A HREF="../ssch23/vectors#g14">Ch23</A><BR> +<CODE>vector?</CODE> <A HREF="../ssch23/vectors#g16">Ch23</A><BR> +<CODE>vector-fill!</CODE> <A HREF="../ssch23/vectors#g21">Ch23</A><BR> +<CODE>vector->list</CODE> <A HREF="../ssch23/vectors#g10">Ch23</A><BR> +<CODE>vector-length</CODE> <A HREF="../ssch23/vectors#g15">Ch23</A><BR> +<CODE>vector-ref</CODE> <A HREF="../ssch23/vectors#g4">Ch23</A><BR> +<CODE>vector-set!</CODE> <A HREF="../ssch23/vectors#g3">Ch23</A><BR> +<A NAME="W"></A> +<CODE>word</CODE> <A HREF="../ssch5/words#g22">Ch5</A><BR> +<CODE>word?</CODE> <A HREF="../ssch6/true#g80">Ch6</A><BR> +word, empty <A HREF="../ssch5/words#g16">Ch5</A><BR> +Wright, Matthew <A HREF="../ssch13/convince-recur#g6">Ch13</A><BR> +<CODE>write</CODE> <A HREF="../ssch22/files#g38">Ch22</A> + + +<HR> +<P><A HREF="../ss-toc2.html">(back to Table of Contents)</A><P> +<A HREF="appuindex.html"><STRONG>BACK</STRONG></A> +chapter thread <A HREF="category.html"><STRONG>NEXT</STRONG></A> + +<P> +<ADDRESS> +<A HREF="../index.html">Brian Harvey</A>, +<CODE>bh@cs.berkeley.edu</CODE> +</ADDRESS> +</BODY> +</HTML> diff --git a/js/games/nluqo.github.io/~bh/ssch27/appuindex.html b/js/games/nluqo.github.io/~bh/ssch27/appuindex.html new file mode 100644 index 0000000..379b907 --- /dev/null +++ b/js/games/nluqo.github.io/~bh/ssch27/appuindex.html @@ -0,0 +1,474 @@ +<P> + +<P> + +<HTML> +<HEAD> +<TITLE>Simply Scheme: Index of Defined Procedures</TITLE> +</HEAD> +<BODY> +<CITE>Simply Scheme</CITE>: +<CITE>Introducing Computer Science</CITE> 2/e Copyright (C) 1999 MIT +<H1>Index of Defined Procedures</H1> + +<TABLE width="100%"><TR><TD> +<IMG SRC="../simply.jpg" ALT="cover photo"> +<TD><TABLE> +<TR><TD align="right"><CITE><A HREF="http://www.cs.berkeley.edu/~bh/">Brian +Harvey</A><BR>University of California, Berkeley</CITE> +<TR><TD align="right"><CITE><A HREF="http://ccrma.stanford.edu/~matt">Matthew +Wright</A><BR>University of California, Santa Barbara</CITE> +<TR><TD align="right"><BR> +<TR><TD align="right"><A HREF="../pdf/ssch27.pdf">Download PDF version</A> +<TR><TD align="right"><A HREF="../ss-toc2.html">Back to Table of Contents</A> +<TR><TD align="right"><A HREF="glossary.html"><STRONG>BACK</STRONG></A> +chapter thread <A HREF="appindex.html"><STRONG>NEXT</STRONG></A> +<TR><TD align="right"><A HREF="http://mitpress.mit.edu/0262082810">MIT +Press web page for <CITE>Simply Scheme</CITE></A> +</TABLE></TABLE> + +<HR> + + +<P>This index contains example procedures whose definitions are in the text and +procedures that you are asked to write as exercises. (The exercises are +marked as such in the index.) Other sources of information are the general +index, which contains technical terms and primitive procedures (for which +there is no Scheme definition); the glossary, which defines many technical +terms; and the Alphabetical Table of Scheme Primitives on page <A HREF="appendix-funlist.html#funlist">funlist</A>. + +<P><BR> +<A HREF="appuindex.html#A">A</A> <A HREF="appuindex.html#B">B</A> <A HREF="appuindex.html#C">C</A> <A HREF="appuindex.html#D">D</A> <A HREF="appuindex.html#E">E</A> <A HREF="appuindex.html#F">F</A> <A HREF="appuindex.html#G">G</A> <A HREF="appuindex.html#H">H</A> <A HREF="appuindex.html#I">I</A> <A HREF="appuindex.html#J">J</A> <A HREF="appuindex.html#K">K</A> <A HREF="appuindex.html#L">L</A> <A HREF="appuindex.html#M">M</A> <A HREF="appuindex.html#N">N</A> <A HREF="appuindex.html#O">O</A> <A HREF="appuindex.html#P">P</A> <A HREF="appuindex.html#Q">Q</A> <A HREF="appuindex.html#R">R</A> <A HREF="appuindex.html#S">S</A> <A HREF="appuindex.html#T">T</A> <A HREF="appuindex.html#U">U</A> <A HREF="appuindex.html#V">V</A> <A HREF="appuindex.html#W">W</A> X Y Z + +<P><BR> +<A NAME="A"></A> +<CODE>abs</CODE> <A HREF="../ssch6/true#g82">Ch6</A><BR> +<CODE>accumulate</CODE> <A HREF="../ssch19/implement-hof#g16">Ch19</A><BR> +<CODE>acronym</CODE> <A HREF="../ssch1/showing#g10">Ch1</A>, <A HREF="../ssch1/showing#g11">Ch1</A>, <A HREF="../ssch8/higher#g26">Ch8</A>, <A HREF="../ssch14/recur-patterns#g14">Ch14</A><BR> +<CODE>add</CODE> <A HREF="../ssch16/match#g12">Ch16</A><BR> +<CODE>add-field</CODE> <A HREF="../ssch25/database#g28">ProjDB</A><BR> +<CODE>add-move</CODE> <A HREF="../ssch20/io#g33">Ch20</A><BR> +<CODE>add-numbers</CODE> <A HREF="../ssch8/higher#g22">Ch8</A>, <A HREF="../ssch14/recur-patterns#g11">Ch14</A><BR> +<CODE>add-three</CODE> <A HREF="../ssch9/lambda#g2">Ch9</A><BR> +<CODE>add-three-to-each</CODE> <A HREF="../ssch9/lambda#g3">Ch9</A><BR> +<CODE>addup</CODE> <A HREF="../ssch14/recur-patterns#g8">Ch14</A><BR> +<CODE>all-evaluated?</CODE> <A HREF="../ssch25/spread-implement#g26">Ch25</A><BR> +<CODE>already-won?</CODE> <A HREF="../ssch20/io#g31">Ch20</A><BR> +<CODE>already-won?</CODE> (exercise) <A HREF="../ssch10/ttt#g28">Ch10</A><BR> +<CODE>always-one</CODE> <A HREF="../ssch8/higher#g24">Ch8</A><BR> +<CODE>amazify</CODE> (exercise) <A HREF="../ssch8/higher#g42">Ch8</A><BR> +<CODE>american-time</CODE> (exercise) <A HREF="../ssch6/true#g115">Ch6</A><BR> +<CODE>any-numbers?</CODE> <A HREF="../ssch8/higher#g34">Ch8</A><BR> +<CODE>aplize</CODE> (exercise) <A HREF="../ssch9/lambda#g43">Ch9</A><BR> +<CODE>apl-sqrt</CODE> (exercise) <A HREF="../ssch9/lambda#g44">Ch9</A><BR> +<CODE>appearances</CODE> (exercise) <A HREF="../ssch9/lambda#g35">Ch9</A><BR> +<CODE>arabic</CODE> (exercise) <A HREF="../ssch12/leap#g14">Ch12</A><BR> +<CODE>area</CODE> <A HREF="../ssch19/implement-hof#g9">Ch19</A><BR> +<CODE>arg-count</CODE> <A HREF="../ssch21/functions-implement#g6">Ch21</A><BR> +<CODE>ask</CODE> <A HREF="../ssch25/database#g17">ProjDB</A><BR> +<CODE>ask-for-name</CODE> <A HREF="../ssch20/io#g49">Ch20</A><BR> +<CODE>ask-question</CODE> <A HREF="../ssch20/io#g51">Ch20</A><BR> +<CODE>ask-user</CODE> <A HREF="../ssch20/io#g34">Ch20</A><BR> +<CODE>average</CODE> <A HREF="../ssch4/defining#g17">Ch4</A><BR> +<A NAME="B"></A> +<CODE>backwards</CODE> <A HREF="../ssch9/lambda#g24">Ch9</A><BR> +<CODE>base-grade</CODE> (exercise) <A HREF="../ssch8/higher#g48">Ch8</A>, <A HREF="../ssch12/leap#g9">Ch12</A><BR> +<CODE>beatle-number</CODE> <A HREF="../ssch8/higher#g36">Ch8</A><BR> +<CODE>before-in-list?</CODE> (exercise) <A HREF="../ssch17/lists#g46">Ch17</A><BR> +<CODE>best-free-square</CODE> <A HREF="../ssch10/ttt#g26">Ch10</A><BR> +<CODE>best-move</CODE> <A HREF="../ssch10/ttt#g23">Ch10</A><BR> +<CODE>best-square</CODE> <A HREF="../ssch10/ttt#g24">Ch10</A><BR> +<CODE>best-square-helper</CODE> <A HREF="../ssch10/ttt#g25">Ch10</A><BR> +<CODE>bill</CODE> (exercise) <A HREF="../ssch23/vectors#g28">Ch23</A><BR> +<CODE>bottles</CODE> <A HREF="../ssch20/io#g7">Ch20</A><BR> +<CODE>bound-check</CODE> <A HREF="../ssch25/spread-implement#g19">Ch25</A><BR> +<CODE>branch</CODE> (exercise) <A HREF="../ssch17/lists#g48">Ch17</A><BR> +<CODE>bridge-val</CODE> <A HREF="../ssch9/bridge#g9">ProjBridge</A><BR> +<CODE>butfirst</CODE> <A HREF="../ssch17/lists#g20">Ch17</A><BR> +<CODE>butlast</CODE> <A HREF="../ssch17/lists#g21">Ch17</A><BR> +<CODE>buzz</CODE> <A HREF="../ssch6/true#g85">Ch6</A><BR> +<A NAME="C"></A> +<CODE>card-list</CODE> <A HREF="../ssch23/vectors#g8">Ch23</A><BR> +<CODE>card-val</CODE> <A HREF="../ssch9/bridge#g3">ProjBridge</A><BR> +<CODE>cell-children</CODE> <A HREF="../ssch25/spread-implement#g41">Ch25</A><BR> +<CODE>cell-expr</CODE> <A HREF="../ssch25/spread-implement#g37">Ch25</A><BR> +<CODE>cell-parents</CODE> <A HREF="../ssch25/spread-implement#g39">Ch25</A><BR> +<CODE>cell-structure</CODE> <A HREF="../ssch25/spread-implement#g33">Ch25</A><BR> +<CODE>cell-value</CODE> <A HREF="../ssch25/spread-implement#g35">Ch25</A><BR> +<CODE>char-count</CODE> <A HREF="../ssch22/files#g29">Ch22</A><BR> +<CODE>children</CODE> <A HREF="../ssch18/trees#g27">Ch18</A><BR> +<CODE>choices</CODE> <A HREF="../ssch1/showing#g19">Ch1</A><BR> +<CODE>choose-beatles</CODE> (exercise) <A HREF="../ssch8/higher#g38">Ch8</A><BR> +<CODE>choose-win</CODE> <A HREF="../ssch10/ttt#g12">Ch10</A><BR> +<CODE>circle-area</CODE> <A HREF="../ssch9/lambda#g20">Ch9</A>, <A HREF="../ssch19/implement-hof#g6">Ch19</A><BR> +<CODE>circumference</CODE> <A HREF="../ssch9/lambda#g21">Ch9</A><BR> +<CODE>cities</CODE> <A HREF="../ssch18/trees#g11">Ch18</A><BR> +<CODE>clear-current-db!</CODE> <A HREF="../ssch25/database#g23">ProjDB</A><BR> +<CODE>combinations</CODE> <A HREF="../ssch1/showing#g21">Ch1</A><BR> +<CODE>command-loop</CODE> <A HREF="../ssch25/spread-implement#g5">Ch25</A><BR> +<CODE>common-words</CODE> (exercise) <A HREF="../ssch9/lambda#g34">Ch9</A><BR> +<CODE>compose</CODE> (exercise) <A HREF="../ssch9/lambda#g38">Ch9</A><BR> +<CODE>compute</CODE> <A HREF="../ssch18/trees#g35">Ch18</A><BR> +<CODE>concatenate</CODE> (exercise) <A HREF="../ssch22/files#g40">Ch22</A><BR> +<CODE>converse</CODE> (exercise) <A HREF="../ssch20/io#g52">Ch20</A><BR> +<CODE>copies</CODE> <A HREF="../ssch14/recur-patterns#g23">Ch14</A><BR> +<CODE>copies</CODE> (exercise) <A HREF="../ssch11/recursion#g16">Ch11</A><BR> +<CODE>count-adjacent-duplicates</CODE> (exercise) <A HREF="../ssch14/recur-patterns#g32">Ch14</A><BR> +<CODE>count</CODE> <A HREF="../ssch8/higher#g25">Ch8</A><BR> +<CODE>count-db</CODE> <A HREF="../ssch25/database#g18">ProjDB</A><BR> +<CODE>countdown</CODE> (exercise) <A HREF="../ssch11/recursion#g15">Ch11</A><BR> +<CODE>count-leaves</CODE> <A HREF="../ssch18/trees#g12">Ch18</A>, <A HREF="../ssch18/trees#g14">Ch18</A><BR> +<CODE>count-leaves-in-forest</CODE> <A HREF="../ssch18/trees#g15">Ch18</A><BR> +<CODE>count-nodes</CODE> (exercise) <A HREF="../ssch18/trees#g37">Ch18</A><BR> +<CODE>count-suit</CODE> <A HREF="../ssch9/bridge#g5">ProjBridge</A><BR> +<CODE>count-ums</CODE> (exercise) <A HREF="../ssch8/higher#g49">Ch8</A>, <A HREF="../ssch11/recursion#g12">Ch11</A><BR> +<CODE>current-db</CODE> <A HREF="../ssch25/database#g9">ProjDB</A><BR> +<CODE>current-fields</CODE> <A HREF="../ssch25/database#g11">ProjDB</A><BR> +<A NAME="D"></A> +<CODE>datum</CODE> <A HREF="../ssch18/trees#g26">Ch18</A><BR> +<CODE>db-fields</CODE> <A HREF="../ssch25/database#g4">ProjDB</A><BR> +<CODE>db-filename</CODE> <A HREF="../ssch25/database#g2">ProjDB</A><BR> +<CODE>db-insert</CODE> <A HREF="../ssch25/database#g14">ProjDB</A><BR> +<CODE>db-records</CODE> <A HREF="../ssch25/database#g6">ProjDB</A><BR> +<CODE>db-set-fields!</CODE> <A HREF="../ssch25/database#g5">ProjDB</A><BR> +<CODE>db-set-filename!</CODE> <A HREF="../ssch25/database#g3">ProjDB</A><BR> +<CODE>db-set-records!</CODE> <A HREF="../ssch25/database#g7">ProjDB</A><BR> +<CODE>deep-appearances</CODE> <A HREF="../ssch17/lists#g41">Ch17</A><BR> +<CODE>deep-map</CODE> <A HREF="../ssch19/implement-hof#g21">Ch19</A><BR> +<CODE>deep-pigl</CODE> <A HREF="../ssch17/lists#g42">Ch17</A>, <A HREF="../ssch19/implement-hof#g18">Ch19</A><BR> +<CODE>depth</CODE> (exercise) <A HREF="../ssch18/trees#g36">Ch18</A><BR> +<CODE>describe</CODE> (exercise) <A HREF="../ssch9/lambda#g29">Ch9</A><BR> +<CODE>describe-time</CODE> (exercise) <A HREF="../ssch6/true#g124">Ch6</A>, <A HREF="../ssch12/leap#g15">Ch12</A><BR> +<CODE>differences</CODE> (exercise) <A HREF="../ssch14/recur-patterns#g30">Ch14</A><BR> +<CODE>disjoint-pairs</CODE> <A HREF="../ssch14/recur-patterns#g4">Ch14</A><BR> +<CODE>divisible?</CODE> <A HREF="../ssch6/true#g86">Ch6</A><BR> +<CODE>double</CODE> <A HREF="../ssch8/higher#g10">Ch8</A>, <A HREF="../ssch8/higher#g31">Ch8</A><BR> +<CODE>doubles</CODE> <A HREF="../ssch14/recur-patterns#g7">Ch14</A><BR> +<CODE>down</CODE> <A HREF="../ssch12/leap#g6">Ch12</A><BR> +<CODE>downup</CODE> <A HREF="../ssch11/recursion#g1">Ch11</A>, <A HREF="../ssch11/recursion#g2">Ch11</A>, <A HREF="../ssch12/leap#g2">Ch12</A><BR> +<A NAME="E"></A> +<CODE>earliest-word</CODE> <A HREF="../ssch15/adv-recur#g2">Ch15</A><BR> +<CODE>echo</CODE> <A HREF="../ssch20/io#g36">Ch20</A><BR> +<CODE>edit-record</CODE> <A HREF="../ssch25/database#g20">ProjDB</A><BR> +<CODE>effect</CODE> <A HREF="../ssch20/io#g11">Ch20</A><BR> +<CODE>ends-e?</CODE> <A HREF="../ssch8/higher#g17">Ch8</A><BR> +<CODE>ends</CODE> (exercise) <A HREF="../ssch5/words#g32">Ch5</A><BR> +<CODE>ends-vowel?</CODE> (exercise) <A HREF="../ssch8/higher#g39">Ch8</A><BR> +<CODE>european-time</CODE> (exercise) <A HREF="../ssch6/true#g114">Ch6</A><BR> +<CODE>even-count?</CODE> (exercise) <A HREF="../ssch8/higher#g40">Ch8</A><BR> +<CODE>evens</CODE> <A HREF="../ssch12/leap#g3">Ch12</A><BR> +<CODE>every</CODE> <A HREF="../ssch19/implement-hof#g10">Ch19</A><BR> +<CODE>every-nth</CODE> <A HREF="../ssch14/recur-patterns#g17">Ch14</A><BR> +<CODE>every-nth-helper</CODE> <A HREF="../ssch14/recur-patterns#g18">Ch14</A>, <A HREF="../ssch14/recur-patterns#g24">Ch14</A><BR> +<CODE>exaggerate</CODE> (exercise) <A HREF="../ssch8/higher#g45">Ch8</A>, <A HREF="../ssch12/leap#g7">Ch12</A><BR> +<CODE>execute-command</CODE> <A HREF="../ssch25/spread-implement#g7">Ch25</A><BR> +<CODE>exhibit</CODE> <A HREF="../ssch25/spread-implement#g8">Ch25</A><BR> +<CODE>explode</CODE> <A HREF="../ssch11/recursion#g10">Ch11</A><BR> +<CODE>extract-digit</CODE> <A HREF="../ssch10/ttt#g19">Ch10</A><BR> +<CODE>extract-ids</CODE> <A HREF="../ssch25/spread-implement#g24">Ch25</A><BR> +<CODE>extra-spaces</CODE> <A HREF="../ssch22/files#g30">Ch22</A><BR> +<A NAME="F"></A> +<CODE>factorial</CODE> <A HREF="../ssch1/showing#g25">Ch1</A>, <A HREF="../ssch12/leap#g1">Ch12</A><BR> +<CODE>fib</CODE> <A HREF="../ssch13/convince-recur#g15">Ch13</A><BR> +<CODE>figure</CODE> <A HREF="../ssch25/spread-implement#g25">Ch25</A><BR> +<CODE>file-map</CODE> <A HREF="../ssch22/files#g21">Ch22</A><BR> +<CODE>file-map-helper</CODE> <A HREF="../ssch22/files#g22">Ch22</A><BR> +<CODE>filemerge</CODE> <A HREF="../ssch22/files#g35">Ch22</A><BR> +<CODE>filemerge-helper</CODE> <A HREF="../ssch22/files#g36">Ch22</A><BR> +<CODE>fill-array-with-rows</CODE> <A HREF="../ssch25/spread-implement#g45">Ch25</A><BR> +<CODE>fill-row-with-cells</CODE> <A HREF="../ssch25/spread-implement#g46">Ch25</A><BR> +<CODE>filter</CODE> <A HREF="../ssch19/implement-hof#g13">Ch19</A><BR> +<CODE>find-triples</CODE> <A HREF="../ssch10/ttt#g6">Ch10</A><BR> +<CODE>first-choice</CODE> <A HREF="../ssch10/ttt#g27">Ch10</A><BR> +<CODE>first</CODE> <A HREF="../ssch17/lists#g18">Ch17</A><BR> +<CODE>first-if-any</CODE> <A HREF="../ssch10/ttt#g15">Ch10</A><BR> +<CODE>first-last</CODE> (exercise) <A HREF="../ssch9/lambda#g37">Ch9</A><BR> +<CODE>first-letters</CODE> <A HREF="../ssch8/higher#g4">Ch8</A><BR> +<CODE>first-number</CODE> <A HREF="../ssch14/recur-patterns#g21">Ch14</A><BR> +<CODE>first-two</CODE> (exercise) <A HREF="../ssch5/words#g28">Ch5</A><BR> +<CODE>flatten</CODE> (exercise) <A HREF="../ssch17/lists#g47">Ch17</A><BR> +<CODE>flip</CODE> <A HREF="../ssch9/lambda#g8">Ch9</A><BR> +<CODE>fourth-power</CODE> <A HREF="../ssch9/lambda#g16">Ch9</A><BR> +<CODE>from-binary</CODE> <A HREF="../ssch15/adv-recur#g6">Ch15</A>, <A HREF="../ssch15/adv-recur#g7">Ch15</A><BR> +<CODE>functions-loop</CODE> <A HREF="../ssch21/functions-implement#g2">Ch21</A><BR> +<A NAME="G"></A> +<CODE>generic-before?</CODE> <A HREF="../ssch25/database#g26">ProjDB</A><BR> +<CODE>gertrude</CODE> (exercise) <A HREF="../ssch7/variables#g18">Ch7</A><BR> +<CODE>get</CODE> <A HREF="../ssch25/database#g24">ProjDB</A><BR> +<CODE>get-arg</CODE> <A HREF="../ssch21/functions-implement#g15">Ch21</A><BR> +<CODE>get-args</CODE> <A HREF="../ssch21/functions-implement#g3">Ch21</A><BR> +<CODE>get-fn</CODE> <A HREF="../ssch21/functions-implement#g16">Ch21</A><BR> +<CODE>get-record</CODE> <A HREF="../ssch25/database#g15">ProjDB</A><BR> +<CODE>get-record-loop</CODE> <A HREF="../ssch25/database#g16">ProjDB</A><BR> +<CODE>get-song</CODE> <A HREF="../ssch22/files#g14">Ch22</A><BR> +<CODE>get-value</CODE> <A HREF="../ssch16/match#g10">Ch16</A><BR> +<CODE>global-array-lookup</CODE> <A HREF="../ssch25/spread-implement#g34">Ch25</A><BR> +<CODE>gpa</CODE> (exercise) <A HREF="../ssch8/higher#g47">Ch8</A>, <A HREF="../ssch12/leap#g8">Ch12</A><BR> +<CODE>greet</CODE> <A HREF="../ssch6/true#g63">Ch6</A><BR> +<CODE>greet</CODE> (exercise) <A HREF="../ssch6/true#g123">Ch6</A><BR> +<A NAME="H"></A> +<CODE>hand-dist-points</CODE> <A HREF="../ssch9/bridge#g8">ProjBridge</A><BR> +<CODE>hang</CODE> (exercise) <A HREF="../ssch9/lambda#g32">Ch9</A><BR> +<CODE>hang-letter</CODE> (exercise) <A HREF="../ssch9/lambda#g33">Ch9</A><BR> +<CODE>has-vowel?</CODE> <A HREF="../ssch14/recur-patterns#g13">Ch14</A><BR> +<CODE>hexagon-area</CODE> <A HREF="../ssch19/implement-hof#g8">Ch19</A><BR> +<CODE>high-card-points</CODE> <A HREF="../ssch9/bridge#g4">ProjBridge</A><BR> +<CODE>hyphenate</CODE> <A HREF="../ssch8/higher#g21">Ch8</A><BR> +<CODE>hypotenuse</CODE> <A HREF="../ssch4/defining#g20">Ch4</A>, <A HREF="../ssch7/variables#g7">Ch7</A><BR> +<A NAME="I"></A> +<CODE>i-can-advance?</CODE> <A HREF="../ssch10/ttt#g22">Ch10</A><BR> +<CODE>i-can-fork?</CODE> <A HREF="../ssch10/ttt#g14">Ch10</A><BR> +<CODE>i-can-win?</CODE> <A HREF="../ssch10/ttt#g11">Ch10</A><BR> +<CODE>increasing?</CODE> <A HREF="../ssch17/lists#g37">Ch17</A><BR> +<CODE>indef-article</CODE> (exercise) <A HREF="../ssch6/true#g118">Ch6</A><BR> +<CODE>in-domain?</CODE> <A HREF="../ssch21/functions-implement#g8">Ch21</A><BR> +<CODE>in-forest?</CODE> <A HREF="../ssch18/trees#g22">Ch18</A><BR> +<CODE>init-array</CODE> <A HREF="../ssch25/spread-implement#g44">Ch25</A><BR> +<CODE>initialize-lap-vector</CODE> <A HREF="../ssch23/vectors#g5">Ch23</A><BR> +<CODE>initials</CODE> (exercise) <A HREF="../ssch11/recursion#g14">Ch11</A><BR> +<CODE>insert</CODE> <A HREF="../ssch25/database#g13">ProjDB</A><BR> +<CODE>insert-and</CODE> (exercise) <A HREF="../ssch5/words#g33">Ch5</A><BR> +<CODE>integer-quotient</CODE> <A HREF="../ssch6/true#g98">Ch6</A><BR> +<CODE>in-tree?</CODE> <A HREF="../ssch18/trees#g20">Ch18</A>, <A HREF="../ssch18/trees#g21">Ch18</A><BR> +<CODE>item</CODE> <A HREF="../ssch8/higher#g33">Ch8</A><BR> +<A NAME="J"></A> +<CODE>join</CODE> (exercise) <A HREF="../ssch22/files#g43">Ch22</A><BR> +<CODE>justify</CODE> <A HREF="../ssch22/files#g28">Ch22</A><BR> +<A NAME="K"></A> +<CODE>keeper</CODE> <A HREF="../ssch9/lambda#g26">Ch9</A><BR> +<CODE>keep-h</CODE> <A HREF="../ssch9/lambda#g25">Ch9</A><BR> +<CODE>knight</CODE> (exercise) <A HREF="../ssch5/words#g31">Ch5</A><BR> +<A NAME="L"></A> +<CODE>lap</CODE> <A HREF="../ssch23/vectors#g6">Ch23</A><BR> +<CODE>last</CODE> <A HREF="../ssch17/lists#g19">Ch17</A><BR> +<CODE>lastfirst</CODE> <A HREF="../ssch22/files#g24">Ch22</A><BR> +<CODE>leader</CODE> (exercise) <A HREF="../ssch23/vectors#g26">Ch23</A><BR> +<CODE>leaf</CODE> <A HREF="../ssch18/trees#g10">Ch18</A><BR> +<CODE>leaf?</CODE> <A HREF="../ssch18/trees#g13">Ch18</A><BR> +<CODE>let-it-be</CODE> (exercise) <A HREF="../ssch9/lambda#g27">Ch9</A><BR> +<CODE>letter-count</CODE> (exercise) <A HREF="../ssch8/higher#g44">Ch8</A>, <A HREF="../ssch14/recur-patterns#g29">Ch14</A><BR> +<CODE>letter-pairs</CODE> <A HREF="../ssch11/recursion#g11">Ch11</A>, <A HREF="../ssch14/recur-patterns#g3">Ch14</A><BR> +<CODE>letterwords</CODE> (exercise) <A HREF="../ssch9/lambda#g31">Ch9</A><BR> +<CODE>list-db</CODE> <A HREF="../ssch25/database#g19">ProjDB</A><BR> +<CODE>list->vector</CODE> <A HREF="../ssch23/vectors#g17">Ch23</A><BR> +<CODE>lm-helper</CODE> <A HREF="../ssch16/match#g8">Ch16</A><BR> +<CODE>load-db</CODE> <A HREF="../ssch25/database#g22">ProjDB</A><BR> +<CODE>locate</CODE> <A HREF="../ssch18/trees#g23">Ch18</A><BR> +<CODE>locate-in-forest</CODE> <A HREF="../ssch18/trees#g24">Ch18</A><BR> +<CODE>location</CODE> <A HREF="../ssch20/io#g28">Ch20</A><BR> +<CODE>location</CODE> (exercise) <A HREF="../ssch14/recur-patterns#g31">Ch14</A><BR> +<CODE>longest-match</CODE> <A HREF="../ssch16/match#g7">Ch16</A><BR> +<CODE>lookup</CODE> <A HREF="../ssch16/match#g9">Ch16</A>, <A HREF="../ssch17/lists#g12">Ch17</A><BR> +<CODE>lookup</CODE> (exercise) <A HREF="../ssch22/files#g41">Ch22</A><BR> +<CODE>lots-of-effect</CODE> <A HREF="../ssch20/io#g13">Ch20</A><BR> +<CODE>lots-of-value</CODE> <A HREF="../ssch20/io#g14">Ch20</A><BR> +<A NAME="M"></A> +<CODE>make-adder</CODE> <A HREF="../ssch9/lambda#g6">Ch9</A><BR> +<CODE>make-db</CODE> <A HREF="../ssch25/database#g1">ProjDB</A><BR> +<CODE>make-deck</CODE> <A HREF="../ssch23/vectors#g11">Ch23</A><BR> +<CODE>make-node</CODE> <A HREF="../ssch18/trees#g25">Ch18</A><BR> +<CODE>map</CODE> <A HREF="../ssch19/implement-hof#g11">Ch19</A><BR> +<CODE>match</CODE> <A HREF="../ssch16/match#g4">Ch16</A><BR> +<CODE>match-special</CODE> <A HREF="../ssch16/match#g6">Ch16</A><BR> +<CODE>match-using-known-values</CODE> <A HREF="../ssch16/match#g5">Ch16</A><BR> +<CODE>max2</CODE> (exercise) <A HREF="../ssch17/lists#g44">Ch17</A><BR> +<CODE>maybe-display</CODE> <A HREF="../ssch20/io#g39">Ch20</A><BR> +<CODE>member-types-ok?</CODE> <A HREF="../ssch21/functions-implement#g10">Ch21</A><BR> +<CODE>merge</CODE> <A HREF="../ssch15/adv-recur#g9">Ch15</A><BR> +<CODE>merge</CODE> (exercise) <A HREF="../ssch14/recur-patterns#g35">Ch14</A><BR> +<CODE>merge-copy</CODE> <A HREF="../ssch22/files#g37">Ch22</A><BR> +<CODE>merge-db</CODE> <A HREF="../ssch25/database#g29">ProjDB</A><BR> +<CODE>mergesort</CODE> <A HREF="../ssch15/adv-recur#g8">Ch15</A><BR> +<CODE>middle-names</CODE> (exercise) <A HREF="../ssch5/words#g34">Ch5</A><BR> +<CODE>music-critic</CODE> <A HREF="../ssch20/io#g43">Ch20</A><BR> +<CODE>my-pair?</CODE> <A HREF="../ssch10/ttt#g8">Ch10</A><BR> +<CODE>my-single?</CODE> <A HREF="../ssch10/ttt#g17">Ch10</A><BR> +<CODE>mystery</CODE> (exercise) <A HREF="../ssch17/lists#g43">Ch17</A><BR> +<A NAME="N"></A> +<CODE>named-every</CODE> <A HREF="../ssch21/functions-implement#g11">Ch21</A><BR> +<CODE>named-keep</CODE> <A HREF="../ssch21/functions-implement#g12">Ch21</A><BR> +<CODE>name-table</CODE> <A HREF="../ssch20/io#g45">Ch20</A><BR> +<CODE>new-db</CODE> <A HREF="../ssch25/database#g12">ProjDB</A><BR> +<CODE>no-db?</CODE> <A HREF="../ssch25/database#g8">ProjDB</A><BR> +<CODE>number-name</CODE> <A HREF="../ssch14/number-name#g1">ProjSpell</A><BR> +<CODE>number-of-arguments</CODE> <A HREF="../ssch21/functions-implement#g13">Ch21</A><BR> +<CODE>numbers</CODE> (exercise) <A HREF="../ssch12/leap#g11">Ch12</A><BR> +<CODE>num-divisible-by-4?</CODE> <A HREF="../ssch6/true#g97">Ch6</A><BR> +<A NAME="O"></A> +<CODE>odds</CODE> (exercise) <A HREF="../ssch14/recur-patterns#g28">Ch14</A><BR> +<CODE>one-half</CODE> <A HREF="../ssch15/adv-recur#g10">Ch15</A><BR> +<CODE>opponent-can-win?</CODE> <A HREF="../ssch10/ttt#g13">Ch10</A><BR> +<CODE>opponent</CODE> <A HREF="../ssch10/ttt#g9">Ch10</A><BR> +<CODE>order</CODE> <A HREF="../ssch17/lists#g1">Ch17</A><BR> +<CODE>order</CODE> (exercise) <A HREF="../ssch23/vectors#g27">Ch23</A><BR> +<CODE>other-half</CODE> <A HREF="../ssch15/adv-recur#g11">Ch15</A><BR> +<A NAME="P"></A> +<CODE>pad</CODE> <A HREF="../ssch22/files#g31">Ch22</A><BR> +<CODE>page</CODE> (exercise) <A HREF="../ssch22/files#g42">Ch22</A><BR> +<CODE>parse</CODE> <A HREF="../ssch18/trees#g34">Ch18</A><BR> +<CODE>parse-scheme</CODE> (exercise) <A HREF="../ssch18/trees#g39">Ch18</A><BR> +<CODE>phone-spell</CODE> (exercise) <A HREF="../ssch15/adv-recur#g16">Ch15</A><BR> +<CODE>phone-unspell</CODE> (exercise) <A HREF="../ssch8/higher#g50">Ch8</A>, <A HREF="../ssch11/recursion#g13">Ch11</A><BR> +<CODE>pi</CODE> <A HREF="../ssch9/lambda#g19">Ch9</A><BR> +<CODE>pigl</CODE> <A HREF="../ssch1/showing#g15">Ch1</A>, <A HREF="../ssch11/recursion#g9">Ch11</A><BR> +<CODE>pin-down</CODE> <A HREF="../ssch25/spread-implement#g18">Ch25</A><BR> +<CODE>pin-down-cell</CODE> <A HREF="../ssch25/spread-implement#g20">Ch25</A><BR> +<CODE>pivots</CODE> <A HREF="../ssch10/ttt#g16">Ch10</A><BR> +<CODE>play-ttt</CODE> <A HREF="../ssch20/io#g29">Ch20</A><BR> +<CODE>play-ttt-helper</CODE> <A HREF="../ssch20/io#g30">Ch20</A><BR> +<CODE>plural</CODE> <A HREF="../ssch6/true#g89">Ch6</A>, <A HREF="../ssch8/higher#g9">Ch8</A><BR> +<CODE>plural</CODE> (exercise) <A HREF="../ssch6/true#g122">Ch6</A><BR> +<CODE>poker-value</CODE> <A HREF="../ssch15/poker#g18">ProjPoker</A>, <A HREF="../ssch15/poker#g19">ProjPoker</A><BR> +<CODE>praise</CODE> <A HREF="../ssch17/lists#g10">Ch17</A><BR> +<CODE>prepend-every</CODE> <A HREF="../ssch1/showing#g20">Ch1</A>, <A HREF="../ssch15/adv-recur#g12">Ch15</A><BR> +<CODE>prev-row</CODE> <A HREF="../ssch25/spread-implement#g9">Ch25</A><BR> +<CODE>print-file</CODE> <A HREF="../ssch22/files#g18">Ch22</A><BR> +<CODE>print-file-helper</CODE> <A HREF="../ssch22/files#g34">Ch22</A><BR> +<CODE>print-position</CODE> <A HREF="../ssch20/io#g37">Ch20</A><BR> +<CODE>print-row</CODE> <A HREF="../ssch20/io#g38">Ch20</A><BR> +<CODE>print-screen</CODE> <A HREF="../ssch25/spread-implement#g32">Ch25</A><BR> +<CODE>process-command</CODE> <A HREF="../ssch25/spread-implement#g6">Ch25</A><BR> +<CODE>process-grades</CODE> <A HREF="../ssch22/files#g25">Ch22</A><BR> +<CODE>progressive-squares?</CODE> (exercise) <A HREF="../ssch14/recur-patterns#g34">Ch14</A><BR> +<CODE>prune</CODE> (exercise) <A HREF="../ssch18/trees#g38">Ch18</A><BR> +<CODE>put-all-cells-in-col</CODE> <A HREF="../ssch25/spread-implement#g14">Ch25</A><BR> +<CODE>put-all-cells-in-row</CODE> <A HREF="../ssch25/spread-implement#g13">Ch25</A><BR> +<CODE>put-all-helper</CODE> <A HREF="../ssch25/spread-implement#g15">Ch25</A><BR> +<CODE>put</CODE> <A HREF="../ssch25/spread-implement#g12">Ch25</A><BR> +<CODE>put-expr</CODE> <A HREF="../ssch25/spread-implement#g23">Ch25</A><BR> +<CODE>put-formula-in-cell</CODE> <A HREF="../ssch25/spread-implement#g17">Ch25</A><BR> +<A NAME="Q"></A> +<CODE>query</CODE> (exercise) <A HREF="../ssch5/words#g35">Ch5</A><BR> +<CODE>quoted?</CODE> <A HREF="../ssch25/spread-implement#g30">Ch25</A><BR> +<CODE>quoted-value</CODE> <A HREF="../ssch25/spread-implement#g31">Ch25</A><BR> +<A NAME="R"></A> +<CODE>real-accumulate</CODE> <A HREF="../ssch19/implement-hof#g17">Ch19</A><BR> +<CODE>real-word?</CODE> <A HREF="../ssch1/showing#g12">Ch1</A>, <A HREF="../ssch8/higher#g19">Ch8</A><BR> +<CODE>real-words</CODE> (exercise) <A HREF="../ssch12/leap#g12">Ch12</A><BR> +<CODE>remdup</CODE> (exercise) <A HREF="../ssch14/recur-patterns#g27">Ch14</A><BR> +<CODE>remove</CODE> (exercise) <A HREF="../ssch12/leap#g13">Ch12</A><BR> +<CODE>remove-adjacent-duplicates</CODE> (exercise) <A HREF="../ssch14/recur-patterns#g33">Ch14</A><BR> +<CODE>remove-once</CODE> <A HREF="../ssch15/adv-recur#g3">Ch15</A><BR> +<CODE>remove-once</CODE> (exercise) <A HREF="../ssch14/recur-patterns#g25">Ch14</A><BR> +<CODE>repeated-numbers</CODE> <A HREF="../ssch10/ttt#g18">Ch10</A><BR> +<CODE>roman-value</CODE> <A HREF="../ssch6/true#g102">Ch6</A><BR> +<CODE>roots</CODE> <A HREF="../ssch7/variables#g16">Ch7</A><BR> +<CODE>rotate</CODE> <A HREF="../ssch1/showing#g18">Ch1</A><BR> +<A NAME="S"></A> +<CODE>safe-pigl</CODE> <A HREF="../ssch14/recur-patterns#g12">Ch14</A><BR> +<CODE>safe-sqrt</CODE> (exercise) <A HREF="../ssch9/lambda#g42">Ch9</A><BR> +<CODE>same-arg-twice</CODE> <A HREF="../ssch9/lambda#g7">Ch9</A><BR> +<CODE>save-db</CODE> <A HREF="../ssch25/database#g21">ProjDB</A><BR> +<CODE>scheme-procedure</CODE> <A HREF="../ssch21/functions-implement#g5">Ch21</A><BR> +<CODE>scrunch-words</CODE> <A HREF="../ssch14/recur-patterns#g9">Ch14</A><BR> +<CODE>second</CODE> <A HREF="../ssch5/words#g13">Ch5</A><BR> +<CODE>second</CODE> (exercise) <A HREF="../ssch9/lambda#g39">Ch9</A><BR> +<CODE>select-id!</CODE> <A HREF="../ssch25/spread-implement#g11">Ch25</A><BR> +<CODE>sent-before?</CODE> <A HREF="../ssch14/recur-patterns#g22">Ch14</A><BR> +<CODE>sentence</CODE> (exercise) <A HREF="../ssch17/lists#g45">Ch17</A><BR> +<CODE>sentence-version</CODE> (exercise) <A HREF="../ssch9/lambda#g30">Ch9</A><BR> +<CODE>sent-equal?</CODE> <A HREF="../ssch16/match#g3">Ch16</A><BR> +<CODE>sent-max</CODE> <A HREF="../ssch14/recur-patterns#g10">Ch14</A><BR> +<CODE>sent-of-first-two</CODE> <A HREF="../ssch8/higher#g11">Ch8</A><BR> +<CODE>set-cell-children!</CODE> <A HREF="../ssch25/spread-implement#g42">Ch25</A><BR> +<CODE>set-cell-expr!</CODE> <A HREF="../ssch25/spread-implement#g38">Ch25</A><BR> +<CODE>set-cell-parents!</CODE> <A HREF="../ssch25/spread-implement#g40">Ch25</A><BR> +<CODE>set-cell-value!</CODE> <A HREF="../ssch25/spread-implement#g36">Ch25</A><BR> +<CODE>set-current-db!</CODE> <A HREF="../ssch25/database#g10">ProjDB</A><BR> +<CODE>set-selected-row!</CODE> <A HREF="../ssch25/spread-implement#g10">Ch25</A><BR> +<CODE>setvalue</CODE> <A HREF="../ssch25/spread-implement#g27">Ch25</A><BR> +<CODE>show-addition</CODE> <A HREF="../ssch20/io#g22">Ch20</A><BR> +<CODE>show-and-return</CODE> <A HREF="../ssch20/io#g48">Ch20</A><BR> +<CODE>show-answer</CODE> <A HREF="../ssch21/functions-implement#g4">Ch21</A><BR> +<CODE>show-list</CODE> <A HREF="../ssch20/io#g25">Ch20</A><BR> +<CODE>shuffle!</CODE> <A HREF="../ssch23/vectors#g12">Ch23</A><BR> +<CODE>sign</CODE> (exercise) <A HREF="../ssch6/true#g112">Ch6</A><BR> +<CODE>skip-songs</CODE> <A HREF="../ssch22/files#g15">Ch22</A><BR> +<CODE>skip-value</CODE> <A HREF="../ssch16/match#g11">Ch16</A><BR> +<CODE>sort2</CODE> (exercise) <A HREF="../ssch6/true#g120">Ch6</A><BR> +<CODE>sort</CODE> <A HREF="../ssch15/adv-recur#g1">Ch15</A>, <A HREF="../ssch25/database#g25">ProjDB</A><BR> +<CODE>sort-digits</CODE> <A HREF="../ssch10/ttt#g20">Ch10</A><BR> +<CODE>sort-on</CODE> <A HREF="../ssch25/database#g27">ProjDB</A><BR> +<CODE>spaces</CODE> <A HREF="../ssch22/files#g32">Ch22</A><BR> +<CODE>spell-digit</CODE> <A HREF="../ssch8/higher#g35">Ch8</A><BR> +<CODE>spell-number</CODE> (exercise) <A HREF="../ssch12/leap#g10">Ch12</A><BR> +<CODE>sphere-area</CODE> <A HREF="../ssch19/implement-hof#g7">Ch19</A><BR> +<CODE>sphere-surface-area</CODE> <A HREF="../ssch9/lambda#g22">Ch9</A><BR> +<CODE>sphere-volume</CODE> <A HREF="../ssch9/lambda#g23">Ch9</A><BR> +<CODE>spreadsheet</CODE> <A HREF="../ssch25/spread-implement#g43">Ch25</A><BR> +<CODE>square-area</CODE> <A HREF="../ssch19/implement-hof#g5">Ch19</A><BR> +<CODE>square</CODE> <A HREF="../ssch4/defining#g1">Ch4</A>, <A HREF="../ssch9/lambda#g15">Ch9</A><BR> +<CODE>ss-eval</CODE> <A HREF="../ssch25/spread-implement#g29">Ch25</A><BR> +<CODE>stupid-ttt</CODE> <A HREF="../ssch20/io#g27">Ch20</A><BR> +<CODE>subsets</CODE> <A HREF="../ssch15/adv-recur#g13">Ch15</A><BR> +<CODE>substitute</CODE> (exercise) <A HREF="../ssch9/lambda#g40">Ch9</A><BR> +<CODE>substitute-letter</CODE> <A HREF="../ssch10/ttt#g4">Ch10</A><BR> +<CODE>substitute-triple</CODE> <A HREF="../ssch10/ttt#g5">Ch10</A><BR> +<CODE>substring?</CODE> (exercise) <A HREF="../ssch15/adv-recur#g15">Ch15</A><BR> +<CODE>substrings</CODE> (exercise) <A HREF="../ssch15/adv-recur#g14">Ch15</A><BR> +<CODE>subword</CODE> <A HREF="../ssch20/io#g40">Ch20</A><BR> +<CODE>subword</CODE> (exercise) <A HREF="../ssch8/higher#g51">Ch8</A><BR> +<CODE>suit-counts</CODE> <A HREF="../ssch9/bridge#g6">ProjBridge</A><BR> +<CODE>suit-dist-points</CODE> <A HREF="../ssch9/bridge#g7">ProjBridge</A><BR> +<CODE>sum-square</CODE> (exercise) <A HREF="../ssch7/variables#g20">Ch7</A><BR> +<CODE>sum-vector</CODE> (exercise) <A HREF="../ssch23/vectors#g20">Ch23</A><BR> +<CODE>superlative</CODE> (exercise) <A HREF="../ssch7/variables#g19">Ch7</A><BR> +<CODE>syllables</CODE> (exercise) <A HREF="../ssch14/recur-patterns#g36">Ch14</A><BR> +<A NAME="T"></A> +<CODE>teen?</CODE> (exercise) <A HREF="../ssch6/true#g116">Ch6</A><BR> +<CODE>third</CODE> (exercise) <A HREF="../ssch5/words#g27">Ch5</A><BR> +<CODE>third-person-singular</CODE> (exercise) <A HREF="../ssch6/true#g111">Ch6</A><BR> +<CODE>thismany</CODE> (exercise) <A HREF="../ssch6/true#g119">Ch6</A><BR> +<CODE>three-firsts</CODE> <A HREF="../ssch8/higher#g2">Ch8</A><BR> +<CODE>tie-game?</CODE> <A HREF="../ssch20/io#g32">Ch20</A><BR> +<CODE>tie-game?</CODE> (exercise) <A HREF="../ssch10/ttt#g29">Ch10</A><BR> +<CODE>transform-beatles</CODE> (exercise) <A HREF="../ssch8/higher#g41">Ch8</A><BR> +<CODE>translate</CODE> <A HREF="../ssch17/lists#g11">Ch17</A>, <A HREF="../ssch17/lists#g34">Ch17</A><BR> +<CODE>truefalse</CODE> <A HREF="../ssch6/true#g107">Ch6</A><BR> +<CODE>true-for-all?</CODE> (exercise) <A HREF="../ssch8/higher#g46">Ch8</A><BR> +<CODE>true-for-all-pairs?</CODE> (exercise) <A HREF="../ssch19/implement-hof#g23">Ch19</A><BR> +<CODE>true-for-any-pair?</CODE> (exercise) <A HREF="../ssch19/implement-hof#g22">Ch19</A><BR> +<CODE>try-putting</CODE> <A HREF="../ssch25/spread-implement#g16">Ch25</A><BR> +<CODE>ttt</CODE> <A HREF="../ssch10/ttt#g1">Ch10</A>, <A HREF="../ssch10/ttt#g7">Ch10</A><BR> +<CODE>ttt-choose</CODE> <A HREF="../ssch10/ttt#g21">Ch10</A><BR> +<CODE>two-first</CODE> (exercise) <A HREF="../ssch5/words#g29">Ch5</A><BR> +<CODE>two-firsts</CODE> <A HREF="../ssch8/higher#g1">Ch8</A><BR> +<CODE>two-first-sent</CODE> (exercise) <A HREF="../ssch5/words#g30">Ch5</A><BR> +<CODE>two-numbers?</CODE> <A HREF="../ssch21/functions-implement#g9">Ch21</A><BR> +<CODE>type-check</CODE> (exercise) <A HREF="../ssch9/lambda#g41">Ch9</A><BR> +<CODE>type-of</CODE> (exercise) <A HREF="../ssch6/true#g117">Ch6</A><BR> +<CODE>type-predicate</CODE> <A HREF="../ssch21/functions-implement#g7">Ch21</A><BR> +<A NAME="U"></A> +<CODE>unabbrev</CODE> (exercise) <A HREF="../ssch9/lambda#g36">Ch9</A><BR> +<CODE>unscramble</CODE> (exercise) <A HREF="../ssch15/adv-recur#g17">Ch15</A><BR> +<CODE>up</CODE> (exercise) <A HREF="../ssch14/recur-patterns#g26">Ch14</A><BR> +<CODE>utensil</CODE> (exercise) <A HREF="../ssch6/true#g113">Ch6</A><BR> +<A NAME="V"></A> +<CODE>valid-date?</CODE> (exercise) <A HREF="../ssch6/true#g121">Ch6</A><BR> +<CODE>valid-fn-name?</CODE> <A HREF="../ssch21/functions-implement#g14">Ch21</A><BR> +<CODE>valid-infix?</CODE> (exercise) <A HREF="../ssch17/lists#g49">Ch17</A><BR> +<CODE>value</CODE> <A HREF="../ssch20/io#g12">Ch20</A><BR> +<CODE>vector-append</CODE> (exercise) <A HREF="../ssch23/vectors#g23">Ch23</A><BR> +<CODE>vector-fill!</CODE> (exercise) <A HREF="../ssch23/vectors#g22">Ch23</A><BR> +<CODE>vector-map</CODE> (exercise) <A HREF="../ssch23/vectors#g24">Ch23</A><BR> +<CODE>vector-map!</CODE> (exercise) <A HREF="../ssch23/vectors#g25">Ch23</A><BR> +<CODE>vector-swap!</CODE> <A HREF="../ssch23/vectors#g13">Ch23</A><BR> +<CODE>verse</CODE> <A HREF="../ssch20/io#g24">Ch20</A>, <A HREF="../ssch20/io#g8">Ch20</A><BR> +<CODE>vowel?</CODE> <A HREF="../ssch8/higher#g18">Ch8</A><BR> +<A NAME="W"></A> +<CODE>who</CODE> (exercise) <A HREF="../ssch9/lambda#g28">Ch9</A><BR> +<CODE>words</CODE> (exercise) <A HREF="../ssch8/higher#g43">Ch8</A> + + +<HR> +<P><A HREF="../ss-toc2.html">(back to Table of Contents)</A><P> +<A HREF="glossary.html"><STRONG>BACK</STRONG></A> +chapter thread <A HREF="appindex.html"><STRONG>NEXT</STRONG></A> + +<P> +<ADDRESS> +<A HREF="../index.html">Brian Harvey</A>, +<CODE>bh@cs.berkeley.edu</CODE> +</ADDRESS> +</BODY> +</HTML> diff --git a/js/games/nluqo.github.io/~bh/ssch27/category.html b/js/games/nluqo.github.io/~bh/ssch27/category.html new file mode 100644 index 0000000..6f0332b --- /dev/null +++ b/js/games/nluqo.github.io/~bh/ssch27/category.html @@ -0,0 +1,161 @@ +<HTML> +<HEAD> +<TITLE>Simply Scheme: Table of Scheme Primitives by Category</TITLE> +</HEAD> +<BODY> +<CITE>Simply Scheme</CITE>: +<CITE>Introducing Computer Science</CITE> 2/e Copyright (C) 1999 MIT +<H1>Table of Scheme Primitives by Category</H1> + +<TABLE width="100%"><TR><TD> +<IMG SRC="../simply.jpg" ALT="cover photo"> +<TD><TABLE> +<TR><TD align="right"><CITE><A HREF="http://www.cs.berkeley.edu/~bh/">Brian +Harvey</A><BR>University of California, Berkeley</CITE> +<TR><TD align="right"><CITE><A HREF="http://ccrma.stanford.edu/~matt">Matthew +Wright</A><BR>University of California, Santa Barbara</CITE> +<TR><TD align="right"><BR> +<TR><TD align="right"><A HREF="../pdf/ssch27.pdf">Download PDF version</A> +<TR><TD align="right"><A HREF="../ss-toc2.html">Back to Table of Contents</A> +<TR><TD align="right"><A HREF="https://people.eecs.berkeley.edu/~bh/ssch26/appuindex.html"><STRONG>BACK</STRONG></A> +chapter thread [no next] +<TR><TD align="right"><A HREF="http://mitpress.mit.edu/0262082810">MIT +Press web page for <CITE>Simply Scheme</CITE></A> +</TABLE></TABLE> + +<HR> + +<P>Use this table if you've forgotten the name of a primitive. Then +look in the index to find more about how to use the primitive. + +<P><SUP>*</SUP> Not part of standard Scheme + +<H2>Words and Sentences</H2> +<P><CODE>appearances</CODE><SUP>*</SUP><CODE> +<BR>before?</CODE><SUP>*</SUP><CODE> +<BR>butfirst (bf)</CODE><SUP>*</SUP><CODE> +<BR>butlast (bl)</CODE><SUP>*</SUP><CODE> +<BR>count</CODE><SUP>*</SUP><CODE> +<BR>empty?</CODE><SUP>*</SUP><CODE> +<BR>equal?</CODE><SUP>*</SUP><CODE> +<BR>first</CODE><SUP>*</SUP><CODE> +<BR>item</CODE><SUP>*</SUP><CODE> +<BR>last</CODE><SUP>*</SUP><CODE> +<BR>member?</CODE><SUP>*</SUP><CODE> +<BR>quote +<BR>sentence (se)</CODE><SUP>*</SUP><CODE> +<BR>sentence?</CODE><SUP>*</SUP><CODE> +<BR>word</CODE><SUP>*</SUP><CODE> +<BR>word?</CODE><SUP>*</SUP> +</CODE><H2>Lists</H2> +<P><CODE>append +<BR>assoc +<BR>car +<BR>cdr +<BR>c...r +<BR>cons +<BR>filter</CODE><SUP>*</SUP><CODE> +<BR>for-each +<BR>length +<BR>list +<BR>list? +<BR>list-ref +<BR>map +<BR>member +<BR>null? +<BR>reduce</CODE><SUP>*</SUP> +<H2>Trees</H2> +<P><CODE>children</CODE><SUP>*</SUP><CODE> +<BR>datum</CODE><SUP>*</SUP><CODE> +<BR>make-node</CODE><SUP>*</SUP> +<H2>Arithmetic</H2> +<P><CODE>+</CODE>, <CODE>-</CODE>, <CODE>*</CODE>, <CODE>/</CODE> +<BR><CODE><</CODE>, <CODE><=</CODE>, <CODE>=</CODE>, <CODE>></CODE>, <CODE>>=</CODE> +<BR><CODE>abs +<BR>ceiling +<BR>cos +<BR>even? +<BR>expt +<BR>floor +<BR>integer? +<BR>log +<BR>max +<BR>min +<BR>number? +<BR>odd? +<BR>quotient +<BR>random +<BR>remainder +<BR>round +<BR>sin +<BR>sqrt +</CODE><H2>True and False</H2> +<P><CODE>and +<BR>boolean? +<BR>cond +<BR>if +<BR>not +<BR>or +</CODE><H2>Variables</H2> +<P><CODE>define +<BR>let +</CODE><H2>Vectors</H2> +<P><CODE>list->vector +<BR>make-vector +<BR>vector +<BR>vector? +<BR>vector-length +<BR>vector->list +<BR>vector-ref +<BR>vector-set! +</CODE><H2>Procedures</H2> +<P><CODE>apply +<BR>lambda +<BR>procedure? +</CODE><H2>Higher-OrderProcedures</H2> +<P><CODE>accumulate</CODE><SUP>*</SUP><CODE> +<BR>every</CODE><SUP>*</SUP><CODE> +<BR>filter</CODE><SUP>*</SUP><CODE> +<BR>for-each +<BR>keep</CODE><SUP>*</SUP><CODE> +<BR>map +<BR>reduce</CODE><SUP>*</SUP><CODE> +<BR>repeated</CODE><SUP>*</SUP> +<H2>Control</H2> +<P><CODE>begin +<BR>error +<BR>load +<BR>trace +<BR>untrace +</CODE><H2>Input/Output</H2> +<P><CODE>align</CODE><SUP>*</SUP><CODE> +<BR>display +<BR>newline +<BR>read +<BR>read-line</CODE><SUP>*</SUP><CODE> +<BR>read-string</CODE><SUP>*</SUP><CODE> +<BR>show</CODE><SUP>*</SUP><CODE> +<BR>show-line</CODE><SUP>*</SUP><CODE> +<BR>write +</CODE><H2>Files and Ports</H2> +<P><CODE>close-all-ports</CODE><SUP>*</SUP><CODE> +<BR>close-input-port +<BR>close-output-port +<BR>eof-object? +<BR>open-input-file +<BR>open-output-file +<P> + +<P><SUP>*</SUP> Not part of standard Scheme +<HR> +<P><A HREF="../ss-toc2.html">(back to Table of Contents)</A><P> +<A HREF="appindex.html"><STRONG>BACK</STRONG></A> +chapter thread [no next] + +<P> +<ADDRESS> +<A HREF="../index.html">Brian Harvey</A>, +<CODE>bh@cs.berkeley.edu</CODE> +</ADDRESS> +</BODY> +</HTML> diff --git a/js/games/nluqo.github.io/~bh/ssch27/credits b/js/games/nluqo.github.io/~bh/ssch27/credits new file mode 100644 index 0000000..b602616 --- /dev/null +++ b/js/games/nluqo.github.io/~bh/ssch27/credits @@ -0,0 +1,78 @@ +\input bkmacs + +\setpart{\null} +\aprojchap{Credits} +\setpart{Credits} + +{\parindent=0pt + +Many of the examples in this book revolve around titles of songs, especially +\idx{Beatles} songs. Since titles aren't covered by copyright, we didn't +need official permission for this, but nevertheless we want to acknowledge +the debt we owe to the great musicians who've added so much pleasure to our +lives. The use of their names here does not mean that they've endorsed our +work; rather, we mean to show our respect for them. + + + +The cover and +the illustrations on pages \hare, \pig, \crank\ (top), \plowshares, \srini, +\sheba, \fish, and \santa\ were drawn by Polly Jordan. + +The illustration on page \graph\ was drawn using Mathematica${}^{TM}$. + +The illustrations on pages \bucket, \dumdee, \typing, +\cabinets, and \accountant\ appear courtesy of +the Bettmann Archive. + +The illustration on page \plugboard\ appears courtesy of the Computer Museum, +Boston. Photograph by Ben G. + +The quotations on pages \alice\ and +\dumdee\ are from {\it Through the +Looking-Glass, and What Alice Found There,\/} by \swapidx{Lewis}{Carroll} +(Macmillan, 1871). +\justidx{Dodgson, Charles} + +The Far Side cartoons on page \larson\ are reprinted by permission of +Chronicle Features, San Francisco, CA. All rights reserved. + +The photograph on page \alonzo\ appears courtesy of UCLA, Department +of Philosophy. + +The photograph on page \tttttm\ appears courtesy of the Computer +Museum, Boston. + +The photograph on page \trombone\ appears courtesy of UPI/Bettmann. + +The illustration on page \gallery\ is {\it Printgallery,\/} by M. C. +Escher. \copyright\ 1956 M. C. Escher Foundation--Baarn--Holland. + +The quotation on page \swallow\ (top) is from ``I Know an Old +Lady,'' a traditional song of which a recent version is copyright +\copyright\ 1952, 1954 by \swapidx{Rose}{Bonne} (words) and +\swapidx{Alan}{Mills} (music). + +The illustration on page \hands\ is {\it Drawing~Hands,\/} by M. C. +Escher. \copyright\ 1948 M. C. Escher Foundation--Baarn--Holland. + +The illustration on page \fractal\ is reprinted with permission from +Michael Barnsley, {\it Fractals Everywhere,\/} Academic Press, 1988, +page 319. + +The illustration on page \bongard\ is reprinted from page 234 of M. +Bongard, {\it Pattern Recognition,\/} Spartan Books, 1970. + +The illustration on page \mondrian\ is {\it Flowering Apple Tree,\/} +by Piet Mondrian, 1912. Courtesy of Collection Haags +Gemeentemuseum, The Hague. + +The illustration on page \polly\ is a photograph by Ben G. + +The illustration on page \oz\ is from {\it The~Wizard~of~Oz,\/} +\copyright\ 1939. Courtesy of Turner Home Entertainment. + +%% The illustration on page \excel\ was drawn using Microsoft Excel${}^{TM}$. + +} +\bye diff --git a/js/games/nluqo.github.io/~bh/ssch27/credits.html b/js/games/nluqo.github.io/~bh/ssch27/credits.html new file mode 100644 index 0000000..2e2b217 --- /dev/null +++ b/js/games/nluqo.github.io/~bh/ssch27/credits.html @@ -0,0 +1,117 @@ +<P> + +<P> + +<HTML> +<HEAD> +<TITLE>Simply Scheme: Credits</TITLE> +</HEAD> +<BODY> +<CITE>Simply Scheme</CITE>: +<CITE>Introducing Computer Science</CITE> 2/e Copyright (C) 1999 MIT +<H1>Credits</H1> + +<TABLE width="100%"><TR><TD> +<IMG SRC="../simply.jpg" ALT="cover photo"> +<TD><TABLE> +<TR><TD align="right"><CITE><A HREF="http://www.cs.berkeley.edu/~bh/">Brian +Harvey</A><BR>University of California, Berkeley</CITE> +<TR><TD align="right"><CITE><A HREF="http://ccrma.stanford.edu/~matt">Matthew +Wright</A><BR>University of California, Santa Barbara</CITE> +<TR><TD align="right"><BR> +<TR><TD align="right"><A HREF="../pdf/ssch27.pdf">Download PDF version</A> +<TR><TD align="right"><A HREF="../ss-toc2.html">Back to Table of Contents</A> +<TR><TD align="right"><A HREF="appendix-gpl.html"><STRONG>BACK</STRONG></A> +chapter thread <A HREF="appendix-funlist.html"><STRONG>NEXT</STRONG></A> +<TR><TD align="right"><A HREF="http://mitpress.mit.edu/0262082810">MIT +Press web page for <CITE>Simply Scheme</CITE></A> +</TABLE></TABLE> + +<HR> + + +<P> +Many of the examples in this book revolve around titles of songs, especially +Beatles songs. Since titles aren't covered by copyright, we didn't +need official permission for this, but nevertheless we want to acknowledge +the debt we owe to the great musicians who've added so much pleasure to our +lives. The use of their names here does not mean that they've endorsed our +work; rather, we mean to show our respect for them. + +<P> +<P> +<P>The cover and +the illustrations on pages <A HREF="../ssch1/showing.html#hare">there</A>, <A HREF="../ssch1/showing.html#pig">there</A>, +<A HREF="../ssch3/people.html#crank">there</A>, +<A HREF="../ssch7/variables.html#srini">there</A>, +<A HREF="../ssch7/variables.html#sheba">there</A>, +<A HREF="../ssch8/higher.html#plowshares">there</A>, +<A HREF="../ssch14/recur-patterns.html#fish">there</A>, and <A HREF="../ssch17/lists.html#santa">there</A> were drawn by Polly Jordan. + +<P>The illustration on page <A HREF="../ssch2/functions.html#graph">there</A> was drawn using Mathematica<SUP><SMALL>TM</SMALL></SUP>. + +<P>The illustrations on pages <A HREF="../ssch3/people.html#bucket">there</A>, <A HREF="../ssch6/true.html#dumdee">there</A>, <A HREF="../ssch20/io.html#typing">there</A>, +<A HREF="../ssch22/files.html#cabinets">there</A>, and <A HREF="../ssch25/spread-implement.html#accountant">there</A> appear courtesy of +the Bettmann Archive. + +<P>The illustration on page <A HREF="../ssch4/defining.html#plugboard">there</A> appears courtesy of the Computer Museum, +Boston. Photograph by Ben G. + +<P>The quotations on pages <A HREF="../ssch4/defining.html#alice">there</A> and +<A HREF="../ssch6/true.html#dumdee">there</A> are from <EM>Through the +Looking-Glass, and What Alice Found There,</EM> by <A NAME="g37"></A><A NAME="g38"></A>Lewis Carroll +(Macmillan, 1871). + +<P>The Far Side cartoons on page <A HREF="../ssch5/words.html#larson">there</A> are reprinted by permission of +Chronicle Features, San Francisco, CA. All rights reserved. + +<P>The photograph on page <A HREF="../ssch9/lambda.html#alonzo">there</A> appears courtesy of UCLA, Department +of Philosophy. + +<P>The photograph on page <A HREF="../ssch10/ttt.html#tttttm">there</A> appears courtesy of the Computer +Museum, Boston. + +<P>The photograph on page <A HREF="../ssch7/variables.html#trombone">there</A> appears courtesy of UPI/Bettmann. + +<P>The illustration on page <A HREF="../ssch11/recursion.html#gallery">there</A> is <EM>Printgallery,</EM> by M. C. +Escher. © 1956 M. C. Escher Foundation-Baarn-Holland. + +<P>The quotation on page <A HREF="../ssch11/recursion.html#swallow">there</A> (top) is from "I Know an Old +Lady," a traditional song of which a recent version is copyright +© 1952, 1954 by <A NAME="g39"></A>Rose Bonne (words) and +<A NAME="g40"></A>Alan Mills (music). + +<P>The illustration on page <A HREF="../ssch12/leap.html#hands">there</A> is <EM>Drawing Hands,</EM> by M. C. +Escher. © 1948 M. C. Escher Foundation-Baarn-Holland. + +<P>The illustration on page <A HREF="../ssch15/adv-recur.html#fractal">there</A> is reprinted with permission from +Michael Barnsley, <EM>Fractals Everywhere,</EM> Academic Press, 1988, +page 319. + +<P>The illustration on page <A HREF="../ssch16/match.html#bongard">there</A> is reprinted from page 234 of M. +Bongard, <EM>Pattern Recognition,</EM> Spartan Books, 1970. + +<P>The illustration on page <A HREF="../ssch18/trees.html#mondrian">there</A> is <EM>Flowering Apple Tree,</EM> +by Piet Mondrian, 1912. Courtesy of Collection Haags +Gemeentemuseum, The Hague. + +<P>The illustration on page <A HREF="../ssch19/implement-hof.html#polly">there</A> is a photograph by Ben G. + +<P>The illustration on page <A HREF="../ssch21/functions-implement.html#oz">there</A> is from <EM>The Wizard of Oz,</EM> +© 1939. Courtesy of Turner Home Entertainment. + +<P> +<P> + +<HR> +<P><A HREF="../ss-toc2.html">(back to Table of Contents)</A><P> +<A HREF="appendix-gpl.html"><STRONG>BACK</STRONG></A> +chapter thread <A HREF="appendix-funlist.html"><STRONG>NEXT</STRONG></A> + +<P> +<ADDRESS> +<A HREF="../index.html">Brian Harvey</A>, +<CODE>bh@cs.berkeley.edu</CODE> +</ADDRESS> +</BODY> +</HTML> diff --git a/js/games/nluqo.github.io/~bh/ssch27/glossary.html b/js/games/nluqo.github.io/~bh/ssch27/glossary.html new file mode 100644 index 0000000..23fedfe --- /dev/null +++ b/js/games/nluqo.github.io/~bh/ssch27/glossary.html @@ -0,0 +1,433 @@ +<P> + +<P> + +<HTML> +<HEAD> +<TITLE>Simply Scheme: Glossary</TITLE> +</HEAD> +<BODY> +<CITE>Simply Scheme</CITE>: +<CITE>Introducing Computer Science</CITE> 2/e Copyright (C) 1999 MIT +<H1>Glossary</H1> + +<TABLE width="100%"><TR><TD> +<IMG SRC="../simply.jpg" ALT="cover photo"> +<TD><TABLE> +<TR><TD align="right"><CITE><A HREF="http://www.cs.berkeley.edu/~bh/">Brian +Harvey</A><BR>University of California, Berkeley</CITE> +<TR><TD align="right"><CITE><A HREF="http://ccrma.stanford.edu/~matt">Matthew +Wright</A><BR>University of California, Santa Barbara</CITE> +<TR><TD align="right"><BR> +<TR><TD align="right"><A HREF="../pdf/ssch27.pdf">Download PDF version</A> +<TR><TD align="right"><A HREF="../ss-toc2.html">Back to Table of Contents</A> +<TR><TD align="right"><A HREF="appendix-funlist.html"><STRONG>BACK</STRONG></A> +chapter thread <A HREF="appuindex.html"><STRONG>NEXT</STRONG></A> +<TR><TD align="right"><A HREF="http://mitpress.mit.edu/0262082810">MIT +Press web page for <CITE>Simply Scheme</CITE></A> +</TABLE></TABLE> + +<HR> + + +<P> +<STRONG>ADT: </STRONG> See <EM>abstract data type.</EM> + +<P><STRONG>a-list: </STRONG> Synonym for <EM>association list.</EM> + +<P><STRONG>abstract data type: </STRONG> A <EM>type</EM> that isn't provided +automatically by Scheme, but that the programmer invents. In order to +create an abstract data type, a programmer must define <EM>selectors</EM> and +<EM>constructors</EM> for that type, and possibly also <EM>mutators.</EM> + +<P><STRONG>abstraction: </STRONG> An approach to complex problems in which the solution +is built in layers. The structures needed to solve the problem (algorithms +and data structures) are implemented using lower-level capabilities and given +names that can then be used as if they were primitive facilities. + +<P><STRONG>actual argument expression: </STRONG> An expression that produces an actual +argument value. In <CODE>(+ 2 (* 3 5))</CODE>, the subexpression <CODE>(* 3 5)</CODE> is +an actual argument expression, since it provides an argument for the +invocation of <CODE>+</CODE>. + +<P><STRONG>actual argument value: </STRONG> A value used as an argument to a +procedure. For example, in the expression <CODE>(+ 2 (* 3 5))</CODE>, the number +<CODE>15</CODE> is an actual argument value. + +<P><STRONG>aggregate: </STRONG> An object that consists of a number of other objects. +For example, a sentence is an aggregate whose elements are words. Lists and +vectors are also aggregates. A word can be thought of, for some purposes, +as an aggregate whose elements are one-letter words. + +<P><STRONG>algorithm: </STRONG> A method for solving a problem. A computer program +is the expression of an algorithm in a particular programming language; the +same algorithm might also be expressed in a different language. + +<P><STRONG>apply: </STRONG> To <EM>invoke</EM> a procedure with arguments. For example, +"Apply the procedure <CODE>+</CODE> to the arguments <CODE>3</CODE> and <CODE>4</CODE>." + +<P><STRONG>argument: </STRONG> A datum provided to a procedure. For example, in +<CODE>(square 13)</CODE>, <CODE>13</CODE> is the argument to <CODE>square</CODE>. + +<P><STRONG>association list: </STRONG> A list in which each element contains a <EM>name</EM> and a corresponding <EM>value.</EM> The list is used to look up a +value, given a name. + +<P><STRONG>atomic expression: </STRONG> An expression that isn't composed of +smaller pieces. + +<P><STRONG>backtracking: </STRONG> A programming technique in which the program tries +one possible solution to a problem, but tries a different solution if the +first isn't successful. + +<P><STRONG>base case: </STRONG> In a recursive procedure, the part that solves the +smallest possible version of the problem without needing a recursive +invocation. + +<P><STRONG>body: </STRONG> An expression, part of the definition of a procedure, that +is evaluated when that procedure is invoked. For example, in + +<P><PRE>(define (square x) + (* x x)) +</PRE> + +<P>the expression <CODE>(* x x)</CODE> is the body of the <CODE>square</CODE> +procedure. + +<P><STRONG>Boolean: </STRONG> The value <CODE>#t</CODE>, meaning "true," or <CODE>#f</CODE>, +meaning "false." + +<P><STRONG>branch node: </STRONG> A <EM>tree node</EM> with <EM>children.</EM> The +opposite of a <EM>leaf node.</EM> + +<P><STRONG>bug: </STRONG> An error in a program. This word did <EM>not</EM> originate +with Grace Hopper finding an actual insect inside a malfunctioning computer; +she may have done so, but the terminology predates computers by centuries. + +<P><STRONG>call: </STRONG> Synonym for <EM>invoke.</EM> + +<P><STRONG>cell: </STRONG> One location in a <EM>spreadsheet.</EM> + +<P><STRONG>children: </STRONG> The <EM>nodes</EM> directly under this one, in a <EM>tree.</EM> (See also <EM>siblings</EM> and <EM>parent.</EM>) + +<P><STRONG>composition of functions: </STRONG> Using the value returned by a function +as an argument to another. In the expression <CODE>(+ 2 (* 3 5))</CODE>, the value +returned by the <CODE>*</CODE> function is used as an argument to the <CODE>+</CODE> +function. + +<P><STRONG>compound expression: </STRONG> An expression that contains subexpressions. +Opposite of <EM>atomic expression.</EM> + +<P><STRONG>compound procedure: </STRONG> A procedure that a programmer defines. This +is the opposite of a <EM>primitive</EM> procedure. + +<P><STRONG>constructor: </STRONG> A procedure that returns a new object of a certain +type. For example, the <CODE>word</CODE> procedure is a constructor that takes +words as arguments and returns a new word. See also <EM>selector</EM>, <EM>mutator</EM>, and <EM>abstract data type.</EM> + +<P><STRONG>data abstraction: </STRONG> The invention of <EM>abstract data types.</EM> + +<P><STRONG>data structure: </STRONG> A mechanism through which several pieces of +information are combined into one larger unit. The most appropriate +mechanism will depend on the ways in which the small pieces are used in +the program, for example, sequentially or in arbitrary order. + +<P><STRONG>database program: </STRONG> A program that maintains an organized collection +of data, with facilities to modify or delete old entries, add new entries, +and select certain entries for display. + +<P><STRONG>datum: </STRONG> The piece of information stored in each node +of a tree. + +<P><STRONG>debugging: </STRONG> The process by which a programmer finds and corrects +mistakes in a program. No interesting program works the first time; +debugging is a skill to develop, not something to be ashamed of. + +<P><STRONG>destructive: </STRONG> A destructive procedure is one that modifies its +arguments. Since the only data type in this book that can be modified is +the vector, all destructive procedures call <CODE>vector-set!</CODE>. + +<P><STRONG>domain: </STRONG> The set of all legal arguments to a function. For +example, the domain of the <CODE>count</CODE> function is the set of all sentences +and all words. + +<P><STRONG>effect: </STRONG> Something a procedure does other than return a +value. For example, a procedure might create a file on disk, or print +something to the screen, or change the contents of a vector. + +<P><STRONG>empty sentence: </STRONG> The sentence <CODE>()</CODE>, which has no words in it. + +<P><STRONG>empty word: </STRONG> The word <CODE>""</CODE>, which has no letters in it. + +<P><STRONG>end-of-file object: </STRONG> What the file-reading procedures return if +asked to read a file with no more unread data. + +<P><STRONG>expression: </STRONG> The representation in Scheme notation of a request to +perform a computation. An expression is either an <EM>atomic expression,</EM> +such as <CODE>345</CODE> or <CODE>x</CODE>, or a <EM>compound expression</EM> consisting of +one or more subexpressions enclosed in parentheses, such as <CODE>(+ 3 4)</CODE>. + +<P><STRONG>field: </STRONG> A single component of a database <EM>record.</EM> For +example, "title" is a field in our example database of albums. + +<P><STRONG>first-class data: </STRONG> Data with the following four properties: +<TABLE><TR><TH align="right" valign="top">•<TD> <TD valign="top">It can be the argument to a procedure. +</TABLE><TABLE><TR><TH align="right" valign="top">•<TD> <TD valign="top">It can be the return value from a procedure. +</TABLE><TABLE><TR><TH align="right" valign="top">•<TD> <TD valign="top">It can be given a name. +</TABLE><TABLE><TR><TH align="right" valign="top">•<TD> <TD valign="top">It can be part of a data aggregate. + +</TABLE> +In Scheme, words, lists, sentences, trees, vectors, ports, +end-of-file objects, Booleans, and procedures are all first-class. + +<P><STRONG>forest: </STRONG> A list of <EM>trees.</EM> + +<P><STRONG>formal parameter: </STRONG> In a procedure definition, the name given to +refer to an argument. In + +<P><PRE>(define (square x) + (* x x))</PRE><CODE>x</CODE> is the formal parameter. (Note that this is not the same +thing as an actual argument! When we invoke <CODE>square</CODE> later, the +argument will be a number, such as 5. The parameter is the <EM>name</EM> for +that number, not the number itself.) +<STRONG>function: </STRONG> A transformation of information that associates a +<EM>return value</EM> with some number of <EM>argument values.</EM> There may +be many different <EM>algorithms</EM> that compute the same function; the +function itself is the relationship between argument values and return +value, no matter how it may be implemented. + +<P><STRONG>functional programming: </STRONG> A style of programming in which programs +are expressed as compositions of functions, emphasizing their arguments and +return values. Compare to <EM>sequential programming.</EM> + +<P><STRONG>global variable: </STRONG> A variable created with <CODE>define</CODE>, which has +meaning everywhere in the program. The opposite of a <EM>local +variable.</EM> + +<P><STRONG>helper procedure: </STRONG> A procedure that exists to help another +procedure do its work. Normally, a user does not invoke a helper procedure +directly. Instead, the user invokes a top-level procedure, which invokes +the helper procedure to assist it in coming up with the answer. + +<P><STRONG>higher-order procedure: </STRONG> A procedure whose domain or range +includes other procedures. + +<P><STRONG>index: </STRONG> A number used to select one of the elements of a vector. + +<P><STRONG>initialization procedure: </STRONG> A procedure that doesn't do any work +except to invoke a <EM>helper procedure</EM> with appropriate argument +values. + +<P><STRONG>interactive: </STRONG> An interactive program or programming language does +its work in response to messages typed by the user at a keyboard (or perhaps +indicated with a pointing device like a mouse). Each message from the user +causes the program to respond in some way. By contrast, a non-interactive +program works with input data that have been prepared in advance. + +<P><STRONG>invoke: </STRONG> To ask a procedure to do its work and come up with a +return value. For example, "Invoke the <CODE>+</CODE> procedure," or "Invoke +the <CODE>+</CODE> procedure with the arguments <CODE>3</CODE> and <CODE>4</CODE>." + +<P><STRONG>keyword: </STRONG> The name of a <EM>special form.</EM> + +<P><STRONG>kludge: </STRONG> A method that gets the job done but isn't very elegant. +Usually the result is a program that can't be extended the next time a new +feature is needed. + +<P><STRONG>leaf node: </STRONG> A <EM>tree node</EM> with no <EM>children.</EM> The +opposite of a <EM>branch node.</EM> + +<P><STRONG>leap of faith: </STRONG> A method for understanding recursion in which you +say to yourself, "I'm going to assume that the recursive call always returns +the right answer," and then use the answer from the recursive call to produce +the answer to the entire problem. + +<P><STRONG>list: </STRONG> A data aggregate containing elements that may +be of any type. + +<P><STRONG>local variable: </STRONG> A variable that associates a formal parameter +name with an actual argument value. It's "local" because the variable +exists only within one procedure invocation. (This includes variables +created by <CODE>let</CODE>.) This is the opposite of a <EM>global variable.</EM> + +<P> +<P><STRONG>mutable: </STRONG> A data structure is mutable if its contents can change. + +<P><STRONG>mutator: </STRONG> A procedure that changes the value of a data object. In +this book, the only mutable data objects we use are vectors, so every +mutator is implemented using <CODE>vector-set!</CODE>. See also <EM>selector,</EM> +<EM>constructor,</EM> and <EM>abstract data type.</EM> + +<P><STRONG>mutual recursion: </STRONG> The program structure in which one procedure +invokes another, and the second invokes the first. + +<P><STRONG>node: </STRONG> An element of a <EM>tree.</EM> A node has a <EM>datum</EM> +and zero or more <EM>children.</EM> + +<P><STRONG>parent: </STRONG> The node above this one, in a <EM>tree.</EM> (See also <EM>children</EM> and <EM>siblings.</EM>) + +<P><STRONG>pattern matcher: </STRONG> A program that takes a pattern and a piece of +data as inputs and says whether or not that piece of data is one that +the pattern describes. We present a pattern matcher in Chapter 16. + +<P><STRONG>plumbing diagram: </STRONG> A pictorial representation of the composition +of functions, with the return value from one procedure connected to an +argument intake of another. + +<P><STRONG>port: </STRONG> An object that Scheme uses to keep track of a file that +is currently open for reading or writing. + +<P><STRONG>portable: </STRONG> A portable program is one that can be run in more than +one version of Scheme or on more than one computer. + +<P><STRONG>potsticker: </STRONG> A Chinese dumpling stuffed with meat and vegetables, +first steamed and then pan-fried, or sometimes first pan-fried and then +simmered in water added to the pan. + +<P><STRONG>predicate: </STRONG> A procedure that always returns a <EM>Boolean</EM> +value. By convention, Scheme predicates have names like "<CODE>equal?</CODE>" that +end in a question mark. + +<P><STRONG>primitive procedure: </STRONG> A procedure that is already defined when a +Scheme session begins. By contrast, a <EM>compound</EM> procedure is one +that the programmer defines in Scheme. + +<P><STRONG>procedure: </STRONG> The expression of an algorithm in Scheme notation. + +<P><STRONG>prompt: </STRONG> A character or characters that an interactive program +prints to tell the user that it's ready for the user to type something. In +many versions of Scheme, the prompt is a <CODE>></CODE> character. + +<P><STRONG>random access: </STRONG> A data structure allows random access if the time +required to locate an element of the structure is independent of its +position within the structure. + +<P><STRONG>range: </STRONG> The set of all possible return values from a function. For +example, the range of the <CODE>count</CODE> function is the set of non-negative +integers. + +<P><STRONG>read-eval-print loop: </STRONG> The overall structure of a Scheme +interpreter. It <EM>reads</EM> an expression from the keyboard, <EM>evaluates</EM> the expression by invoking procedures, etc., and <EM>prints</EM> +the resulting value. The same process repeats forever. + +<P><STRONG>record: </STRONG> One complete entry in a database. For example, one album +in our database of albums. A record contains several <EM>fields.</EM> + +<P><STRONG>recursion: </STRONG> Solving a big problem by reducing it to smaller +problems of the same kind. If something is defined recursively, then it's +defined in terms of itself. See <EM>recursion.</EM> + +<P><STRONG>recursive case: </STRONG> In a recursive procedure, the part that requires a +recursive invocation. The opposite of the <EM>base case.</EM> + +<P><STRONG>rest parameter: </STRONG> A parameter that represents a variable number of +arguments. In the formal parameter list <CODE>(a b . x)</CODE>, <CODE>x</CODE> is a +rest parameter. + +<P><STRONG>result replacement: </STRONG> A technique people can use to figure out the +value of a complicated Scheme expression by rewriting the expression +repeatedly, each time replacing some small subexpression with a +simpler expression that has the same value, +until all that's left is a single quoted or self-evaluating value. + +<P><STRONG>robust: </STRONG> Able to function despite user errors. Robust programs +check for likely errors and recover from them gracefully. + +<P><STRONG>root node: </STRONG> The <EM>node</EM> at the very top of a <EM>tree.</EM> + +<P><STRONG>selector: </STRONG> A procedure that takes an object as its argument and +returns some part of that object. For example, the selector <CODE>first</CODE> +takes a word or sentence as argument and returns the first letter of the +word or first word of the sentence. See also <EM>constructor,</EM> <EM>mutator,</EM> and <EM>abstract data type.</EM> + +<P><STRONG>self-evaluating: </STRONG> An expression is self-evaluating if, when +evaluated, it has as its value the expression itself. Numbers, Booleans, and +strings are the only self-evaluating objects we use in this book. + +<P><STRONG>semipredicate: </STRONG> A procedure that answers a yes-no question by +returning <CODE>#f</CODE> for "no," but instead of returning <CODE>#t</CODE> for +"yes," it returns some additional piece of information. The primitive +<CODE>member</CODE> procedure is a good example of a semipredicate. +("Semipredicate" isn't a common term; we made it up for this book.) + +<P><STRONG>sequencing: </STRONG> Evaluating two or more expressions one after the +other, for the sake of their <EM>effects.</EM> + +<P><STRONG>sequential programming: </STRONG> A style of programming in which +programs say, "First do this, then do that, then do that other thing." +(Compare to <EM>functional programming.</EM>) + +<P><STRONG>siblings: </STRONG> Two <EM>nodes</EM> of a <EM>tree</EM> that are the +children of the same node. (See also <EM>children</EM> and <EM>parent.</EM>) + +<P><STRONG>side effect: </STRONG> See <EM>effect.</EM> + +<P><STRONG>special form: </STRONG> A Scheme expression that begins with a <EM>keyword</EM> and is evaluated using a special rule. In particular, some of +the subexpressions might not be evaluated. The keywords used in this book +are <CODE>and</CODE>, <CODE>begin</CODE>, <CODE>cond</CODE>, <CODE>define</CODE>, <CODE>if</CODE>, <CODE>lambda</CODE>, <CODE>let</CODE>, <CODE>or</CODE>, and <CODE>quote</CODE>. (The keyword itself is also +sometimes called a special form.) + +<P><STRONG>spreadsheet program: </STRONG> A program that maintains a two-dimensional +display of data can compute some elements automatically, based on the +values of other elements. + +<P><STRONG>state: </STRONG> A program's memory of what has happened in the past. + +<P><STRONG>string: </STRONG> A <EM>word</EM> delimited by double-quote +marks, such as <CODE>"A Hard Day's Night"</CODE> or <CODE>"000123"</CODE>. + +<P><STRONG>structured list: </STRONG> A list with <EM>sublists.</EM> + +<P><STRONG>subexpression: </STRONG> An element of a <EM>compound expression.</EM> For +example, the expression <CODE>(+ (* 2 3) 4)</CODE> has three subexpressions: <CODE>+</CODE>, <CODE>(* 2 3)</CODE>, and <CODE>4</CODE>. + +<P><STRONG>sublist: </STRONG> An element of a list that is itself a smaller list. For +example, <CODE>(c d)</CODE> is a sublist of the list <CODE>(a b (c d) e)</CODE>. + +<P><STRONG>substitution model: </STRONG> The way we've explained how Scheme evaluates +function invocations. According to the substitution model, when a compound +procedure is invoked, Scheme goes through the body of that procedure and +replaces every copy of a formal parameter with the corresponding actual +argument value. Then Scheme evaluates the resulting expression. + +<P><STRONG>subtree: </STRONG> A tree that is part of a larger tree. + +<P><STRONG>symbol: </STRONG> A word that isn't a number or a string. + +<P><STRONG>symbolic computing: </STRONG> Computing that is about words, sentences, and +ideas instead of just numbers. + +<P> +<P><STRONG>tree: </STRONG> A two-dimensional data structure used to represent +hierarchical information. + +<P><STRONG>tree recursion: </STRONG> A form of recursion in which a procedure calls +itself recursively more than one time in each level of the recursion. + +<P><STRONG>type: </STRONG> A category of data. For example, words, sentences, +Booleans, and procedures are types. Some types overlap: All numbers are +also words, for example. + +<P> +<P><STRONG>variable: </STRONG> A connection between a name and a value. Variables can +be <EM>global</EM> or <EM>local.</EM> + +<P><STRONG>vector: </STRONG> A primitive data structure that is mutable and allows +random access. + +<P><STRONG>word: </STRONG> A sequence of characters, including letters, digits, or +punctuation. Numbers are a special case of words. + +<P> + +<HR> +<P><A HREF="../ss-toc2.html">(back to Table of Contents)</A><P> +<A HREF="appendix-funlist.html"><STRONG>BACK</STRONG></A> +chapter thread <A HREF="appuindex.html"><STRONG>NEXT</STRONG></A> + +<P> +<ADDRESS> +<A HREF="../index.html">Brian Harvey</A>, +<CODE>bh@cs.berkeley.edu</CODE> +</ADDRESS> +</BODY> +</HTML> |