Skip to content

Commit 89b96ef

Browse files
committed
simplify stepper and fix unevaluated id bug
1 parent a72b8d8 commit 89b96ef

File tree

3 files changed

+19
-11
lines changed

3 files changed

+19
-11
lines changed

pkgs/htdp-pkgs/htdp-lib/stepper/DESIGN-NOTES

+14
Original file line numberDiff line numberDiff line change
@@ -962,3 +962,17 @@ code, and works better, too.
962962
Nice to be here again...
963963

964964
2010-12-04
965+
966+
**************
967+
968+
How time flies. Small bug fixes; it's now illegal to refer to undefined
969+
values. That is, (letrec ([a a]) 3) is illegal. This caused stepper
970+
breakage, and I was worried that fixing this was going to require some
971+
terrible deep surgery. In fact, though, it looks like this change
972+
makes things *simpler*; it looks like I was going out of my way to
973+
preserve the undefined values for situations where it might turn up in
974+
student programs, and now I can omit that check.
975+
976+
2013-05-18
977+
978+
**************

pkgs/htdp-pkgs/htdp-lib/stepper/private/annotate.rkt

+4-11
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,7 @@
436436
; wish me luck.
437437

438438

439-
(define (let-abstraction stx output-identifier make-init-list)
439+
(define (let-abstraction stx output-identifier)
440440
(with-syntax ([(_ ([(var ...) val] ...) . bodies) stx])
441441
(match-let*
442442
([binding-sets (map syntax->list (syntax->list #'((var ...) ...)))]
@@ -491,7 +491,7 @@
491491
free-varref-sets-vals))
492492
binding-list)]
493493
[counter-id #`lifting-counter]
494-
[unevaluated-list (make-init-list binding-list)]
494+
[unevaluated-list (map (lambda (b) *unevaluated*) binding-list)]
495495
[outer-initialization
496496
#`([(#,@lifted-vars #,@binding-list #,let-counter)
497497
(values #,@(append (map (lambda (dc_binding) counter-id)
@@ -788,16 +788,9 @@
788788
#,rolled-into-fakes))
789789
all-free-vars))]
790790

791-
[(let-values . _)
792-
(let-abstraction exp
793-
#`let-values
794-
(lambda (bindings)
795-
(map (lambda (_) *unevaluated*) bindings)))]
791+
[(let-values . _) (let-abstraction exp #`let-values)]
796792

797-
[(letrec-values . _)
798-
(let-abstraction exp
799-
#`letrec-values
800-
(lambda (bindings) (map (lambda (b) #`#,b) bindings)))]
793+
[(letrec-values . _) (let-abstraction exp #`letrec-values)]
801794

802795

803796
; $

pkgs/htdp-pkgs/htdp-lib/stepper/private/model.rkt

+1
Original file line numberDiff line numberDiff line change
@@ -522,6 +522,7 @@
522522
;; step through a single expanded expression.
523523
(define (step-through-expression expanded)
524524
(define annotated (a:annotate expanded break show-lambdas-as-lambdas?))
525+
#;(printf "annotated: ~s\n" annotated)
525526
(parameterize ([test-engine:test-silence #t])
526527
(eval-syntax annotated)))
527528

0 commit comments

Comments
 (0)