From: Ramakrishnan Muthukrishnan <vu3rdd@gmail.com>
Date: Mon, 4 Jun 2012 04:50:28 +0000 (+0530)
Subject: rewrite `quote->cons' using `match'.
X-Git-Url: https://git.rkrishnan.org/%5B/frontends/configuration.rst?a=commitdiff_plain;h=002f83ea8883fdb3bcdafad16c967b67d9d34ba3;p=sicp.git

rewrite `quote->cons' using `match'.
---

diff --git a/src/sicp/eval-4.33.rkt b/src/sicp/eval-4.33.rkt
index 67d821c..ffc7084 100644
--- a/src/sicp/eval-4.33.rkt
+++ b/src/sicp/eval-4.33.rkt
@@ -253,9 +253,9 @@
 
 (define (quote->cons exp)
   ;(display (format "q->c: ~s~%" exp))
-  (if (null? exp)
-      '()
-      (list 'cons (list 'quote (car exp)) (quote->cons (cdr exp)))))
+  (match exp
+    [(? null?)  '()]
+    [_          `(cons (quote ,(car exp)) ,(quote->cons (cdr exp)))]))
 
 ;; eval
 (define (eval exp env)