From: Ramakrishnan Muthukrishnan Date: Tue, 23 Nov 2010 18:21:23 +0000 (+0530) Subject: solution to 2.54 X-Git-Url: https://git.rkrishnan.org/pf/content/en/seg/bcase/simplejson/decoder.py.html?a=commitdiff_plain;h=2606485df645106e01be24ae109466ca6d447cc2;p=sicp.git solution to 2.54 --- diff --git a/src/sicp/ex2_54.rkt b/src/sicp/ex2_54.rkt new file mode 100644 index 0000000..ef27b5a --- /dev/null +++ b/src/sicp/ex2_54.rkt @@ -0,0 +1,13 @@ +#lang racket + +(define (equal? s1 s2) + (cond ((null? s1) (null? s2)) + ((and (symbol? s1) + (symbol? s2)) (eq? s1 s2)) + ((and (number? s1) + (number? s2)) (= s1 s2)) + ((and (pair? s1) + (pair? s2) + (equal? (car s1) + (car s2))) (equal? (cdr s1) (cdr s2))) + (else #f)))