Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Scheme (programming language)
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
===Equivalence predicates=== {{See also|relational operator}} Scheme has three different types of equivalence between arbitrary objects denoted by three different ''equivalence predicates'', relational operators for testing equality, <code>eq?</code>, <code>eqv?</code> and <code>equal?</code>: * <code>eq?</code> evaluates to <code>#f</code> unless its parameters represent the same data object in memory; * <code>eqv?</code> is generally the same as <code>eq?</code> but treats primitive objects (e.g. characters and numbers) specially so that numbers that represent the same value are <code>eqv?</code> even if they do not refer to the same object; * <code>equal?</code> compares data structures such as lists, vectors and strings to determine if they have congruent structure and <code>eqv?</code> contents.(R5RS sec. 6.1)<ref name="r5rs"/> Type dependent equivalence operations also exist in Scheme: <code>string=?</code> and <code>string-ci=?</code> compare two strings (the latter performs a case-independent comparison); <code>char=?</code> and <code>char-ci=?</code> compare characters; <code>=</code> compares numbers.<ref name="r5rs"/>
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)