Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Have you implemented your R5RS today?

Name: Anonymous 2013-07-06 22:35

Name: Anonymous 2013-07-07 18:18

>>9
eq? compares the addresses of two objects. eqv? compares the values. While C uses the same operator for both comparisons, it requires different syntax.

#include <stdio.h>

int main()
{
    int x;
    int y;

    x = y = 42;
    printf("(eq?  x y) => %s\n", &x == &y ? "true" : "false");
    printf("(eqv? x y) => %s\n", x == y ? "true" : "false");
    return 0;
}


Output:
(eq?  p q) => false
(eqv? p q) => true


So even in C, x and y are both similar and different at the same time. They require two different kinds of comparisons.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List