Fundamentals of CS I (CS151 2001S) : Reference
[Current]
[Discussions]
[Glance]
[Honesty]
[Instructions]
[Links]
[News]
[Search]
[Syllabus]
Primary
[Examples]
[Exams]
[Handouts]
[Homework]
[Labs]
[Outlines]
[Quizzes]
[Readings]
[Reference]
Sets
[Blackboard]
[Scheme Report]
[SamR's Schedule]
[Rebelsky/Fall 2000]
[Walker/Fall2000]
[Stone/Spring2000]
Links
| Procedure | equal? |
|---|---|
| Parameters | val1, a value val2, another value |
| Purpose | Determines if val1 and val2 are equal, even if they are complex structures. Compares individual elements in lists.. Particularly appropriate for lists, strings, and vectors. |
| Produces | A truth value: true (#t)
if the two values are equal in the given sense,
false (#f) if they're not. |
| Preconditions | Exactly two parameters (verified). |
| Examples | > (equal? 2 2) #t > (equal? 2 2 2) equal?: expects 2 arguments, given 3: 2 2 2 > (equal? 2 (+ 1 1)) #t > (equal? "hello" "hello") #t > (equal? 'hello 'hello) #t > (equal? 'hello (car (list 'hello 'goodbye))) #t > (equal? null null) #t > (equal? (cons 'a null) (cons 'a null)) #t > (equal? 5.0 5) #f > (equal? 5.0 5.0) #t |
"..." (double quote) |
+ (plus) |
#\character (pound backslash) |
#\newline |
#\space |
; (semicolon)
* (times) |
abs |
and |
append |
boolean? |
car |
cdr |
char? |
char<? |
char<=? |
char=? |
char>=? |
char>? |
char-alphabetic? |
char-ci<? |
char-ci<=? |
char-ci=? |
char-ci>? |
char-ci>=? |
char->integer |
char-downcase |
char-lower-case? |
char-numeric? |
char-upper-case? |
char-upcase |
char-whitespace? |
complex? |
cons |
eq? |
equal? |
eqv? |
exact? |
exact->inexact |
exp |
expt |
inexact? |
integer? |
integer->char
length |
list |
list? |
list-ref |
null |
null? |
number? |
procedure?
rational? |
real? |
reverse
sqrt |
string? |
symbol?
[Current]
[Discussions]
[Glance]
[Honesty]
[Instructions]
[Links]
[News]
[Search]
[Syllabus]
Primary
[Examples]
[Exams]
[Handouts]
[Homework]
[Labs]
[Outlines]
[Quizzes]
[Readings]
[Reference]
Sets
[Blackboard]
[Scheme Report]
[SamR's Schedule]
[Rebelsky/Fall 2000]
[Walker/Fall2000]
[Stone/Spring2000]
Links
Disclaimer: I usually create these pages on the fly. This means that they are rarely proofread and may contain bad grammar and incorrect details. It also means that I may update them regularly (see the history for more details). Feel free to contact me with any suggestions for changes.
This page was generated by Siteweaver on Thu Feb 22 05:47:55 2001.
This page may be found at http://www.cs.grinnell.edu/~rebelsky/Courses/CS151/2001S/equal-p.html.
You may validate
this page's HTML.
The source was last modified Fri Feb 2 06:39:31 2001.