#lang racket ;;;;;;;;;; ;; 2.53 ;; ;;;;;;;;;; (list 'a 'b 'c) ;; '(a b c) (list (list 'george)) ;; '((george)) (cdr '((x1 x2) (y1 y2))) ;; '((y1 y2)) (cadr '((x1 x2) (y1 y2))) ;; '(y1 y2) (pair? (car '(a short list))) ;; #f (memq 'red '((red shoes) (blue socks))) ;; #f (memq 'red '(red shoes blue socks)) ;; '(red shoes blue socks) ;;;;;;;;;; ;; 2.54 ;; ;;;;;;;;;; (define (my-equal? x y) (cond [(and (symbol? x) (symbol? y)) (eq? x y)] [(and (list? x) (list? y)) (or (and (empty? x) (empty? y)) (and (eq? (first x) (first y)) (my-equal? (rest x) (rest y))))] [else #f])) (my-equal? '(this is a list) '(this is a list)) ;; #t (my-equal? '(this is a list) '(this (is a) list)) ;; #f ;;;;;;;;;; ;; 2.55 ;; ;;;;;;;;;; (car ''abracadabra) ;; 'quote ;; ''abracadabra is the same as '(quote abracadabra) whose car is the symbol 'quote