Ein Symbol ist Variable nicht in Code zitierte ein
(define r 'x) ; define the variable r to be the symbol x
(eq? (car test) r) ; ==> #f (compares the symbol r with symbol x)
(eq? (cadr test) r) ; ==> #t (compares the symbol x with the symbol x)
(eq? (car test) 'r) ; ==> #t (compares the symbol r with the symbol r)
Symbol in der Liste Vergleich
(define test-list '(fi fa foo))
(define test-symbol 'fi)
(eq? (car test-list) test-symbol) ; ==> #t (compares fi with fi)
(eq? 'fi 'fi) ; ==> #t (compares fi with fi)
Charakter in Stringvergleich (Die Frage Titel ist über nicht Symbolzeichen):
(define test-string "test")
(define test-char #\t)
(eqv? (string-ref test-string 0) test-char) ; ==> #t (compares #\t with #\t)
(eqv? #\t #\t) ; ==> #t (compares #\t with #\t)
Fragen Sie, wie Sie auf die Symbole 'r',' x' a zugreifen können nd '-', wie in' car', 'cadr' und' caddr'? – Sylwester
Nein, ich frage, wie kann ich 'wahr' für die Operation bekommen (gleich? (Autotest) r) Als ob es ** r ** mit ** r ** vergleicht, weil es tatsächlich 'Fehler' zurückgibt –
Sie sollten schreiben: '(definieren (unterscheiden Test) (gleich? (Car Test) 'r))'. – Renzo