projects
/
sicp.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
ef9bb63
)
rewrite `quote->cons' using `match'.
author
Ramakrishnan Muthukrishnan
<vu3rdd@gmail.com>
Mon, 4 Jun 2012 04:50:28 +0000
(10:20 +0530)
committer
Ramakrishnan Muthukrishnan
<vu3rdd@gmail.com>
Mon, 4 Jun 2012 04:50:28 +0000
(10:20 +0530)
src/sicp/eval-4.33.rkt
patch
|
blob
|
history
diff --git
a/src/sicp/eval-4.33.rkt
b/src/sicp/eval-4.33.rkt
index 67d821cb524392976e70d7408e5edde0482e511a..ffc7084206f64daee0ecb2a217aa2667bca61b60 100644
(file)
--- 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)