|author||bnewbold <email@example.com>||2009-02-26 02:27:29 -0500|
|committer||bnewbold <firstname.lastname@example.org>||2009-02-26 02:27:29 -0500|
2 files changed, 9 insertions, 30 deletions
diff --git a/ps03_evalapply/bnewbold_ps3.txt b/ps03_evalapply/bnewbold_ps3.txt
index 9bcaa26..6cfbb4c 100644
@@ -15,6 +15,7 @@ have just asked!
It would probably make more sense to have some symbols and functions as tagged
@@ -29,6 +30,7 @@ character names and required registration with declare-literal-function.
@@ -41,21 +43,7 @@ b.
We have to delay the integrand call even further than kons does; fortunately
we have good syntax for this now!
-(define (integral (integrand lazy) initial-value dt)
- (define int
- (kons initial-value
- (add-streams (scale-stream integrand dt)
-(define (solve f y0 dt)
- (define y (integral dy y0 dt))
- (define dy (map-stream f y))
-(ref-stream (solve (lambda (x) x) 1 0.001) 1000)
@@ -63,6 +51,8 @@ Problem 3.4
I will answer with a quick program (see code).
CONS wants a list as it's second argument (at least most schemes, MIT/GNU seems
a little looser?), (dy lazy memo) would have to get checked sooner rather than
@@ -77,20 +67,20 @@ created, blocking garbage collection.
I implemented crude profiling: after evaluating an expression, a table can be
-printed out showing the number of procedure and primative calls.
+printed out showing the number of procedure and primitive calls.
A pair of eq-based hash tables are used to store the running call counts.
Performance does seem to be negatively effected (eg (fib 12) took 10+ seconds
using a very crude algorithm vs. almost instant in the top level repl), but
that might just be the generic dispatch stuff.
-I put in code for an enable/disable flag but i'm not sure it's even neccessary.
+I put in code for an enable/disable flag but i'm not sure it's even necessary.
-The most-needed-change is to print just the primative/compound procedure name
+The most-needed-change is to print just the primitive/compound procedure name
symbols, not their string representations. I wanted to make sure that the
same procedure by different names would be counted together, but in the end
it looks like a big mess. My scmutils-enabled version of MIT Scheme has a
procedure-name method that does the trick, but it doesn't seem to be in the
default distribution so I left it out.
diff --git a/ps03_evalapply/bnewbold_work.scm b/ps03_evalapply/bnewbold_work.scm
index e74c65e..d968fd2 100644
@@ -232,17 +232,6 @@ sandwich
- (set! PROFILING-ENABLED #f)
- ( *primative-call-database*
- (set! *compound-call-database*
- (set! PROFILING-ENABLED #t))
-(define cpr clear-profile-results) ; shorter
(set! PROFILING-ENABLED #f)