learning-sicp

My embarrassing half assed SICP run.
git clone https://kaka.farm/~git/learning-sicp
Log | Files | Refs

commit 01612d8cee1c23740a79874595d48a398afbf43f
parent 7d6e880fb77a5c9d2151a38aef1f4322ecbfdfce
Author: Yuval Langer <yuval.langer@gmail.com>
Date:   Mon, 22 Jul 2024 11:35:50 +0300

Add the `=` primitive to the original REPL.  Also simplify utility macro `dpp`.

Diffstat:
Msicp/solutions/chapter-4/original-repl.scm | 1+
Msicp/utils.scm | 34++++++++++++++++------------------
2 files changed, 17 insertions(+), 18 deletions(-)

diff --git a/sicp/solutions/chapter-4/original-repl.scm b/sicp/solutions/chapter-4/original-repl.scm @@ -423,6 +423,7 @@ frame to VAL." (list '- -) (list '* *) (list '/ /) + (list '= =) (list 'display display) (list 'write write) (list 'read read))) diff --git a/sicp/utils.scm b/sicp/utils.scm @@ -56,25 +56,23 @@ (display "\n\n") x-val))) - (define-syntax dpp + (define-syntax-rule (dpp x) ;; Debug Pretty Print. - (syntax-rules () - ((dpp x) - (when (debug?) - (let* ((loc (current-source-location)) - (line-number (cdr (assoc 'line loc eq?))) - (column-number (cdr (assoc 'column loc eq?))) - (x-val x)) - (display line-number) - (display ":") - (display column-number) - (display ":") - (newline) - (pretty-print (quote x)) - (display "=> ") - (pretty-print x-val) - (newline) - x-val))))) + (when (debug?) + (let* ((loc (current-source-location)) + (line-number (cdr (assoc 'line loc eq?))) + (column-number (cdr (assoc 'column loc eq?))) + (x-val x)) + (display line-number) + (display ":") + (display column-number) + (display ":") + (newline) + (pretty-print (quote x)) + (display "=> ") + (pretty-print x-val) + (newline) + x-val))) (define (pp x) (pretty-print x))