@@ -398,19 +398,19 @@ the typed racket language.
398
398
(define-syntax (for/lists: stx)
399
399
(syntax-parse stx
400
400
[(_ a1:optional-standalone-annotation*
401
- (var:optionally-annotated-formal ... )
401
+ (var:optionally-annotated-formal ... (~optional result:result-clause) )
402
402
clause:for-clauses
403
403
a2:optional-standalone-annotation*
404
404
c ... )
405
405
(define all-typed? (andmap values (attribute var.ty)))
406
406
(define for-stx
407
407
(quasisyntax/loc stx
408
- (for/lists (var.ann-name ... )
408
+ (for/lists (var.ann-name ... (~@ . (~? result ())) )
409
409
(clause.expand ... ... )
410
410
c ... )))
411
411
((attribute a1.annotate)
412
412
((attribute a2.annotate)
413
- (if all-typed?
413
+ (if ( and all-typed? (not (attribute result)))
414
414
(add-ann
415
415
for-stx
416
416
#'(values var.ty ... ))
@@ -425,12 +425,12 @@ the typed racket language.
425
425
(define all-typed? (andmap values (attribute accum.ty)))
426
426
(define for-stx
427
427
(quasisyntax/loc stx
428
- (for/fold ((accum.ann-name accum.init) ... )
428
+ (for/fold ((accum.ann-name accum.init) ... (~@ . (~? accum.result ())) )
429
429
(clause.expand ... ... )
430
430
c ... )))
431
431
((attribute a1.annotate)
432
432
((attribute a2.annotate)
433
- (if all-typed?
433
+ (if ( and all-typed? (not (attribute accum.result)))
434
434
(add-ann
435
435
for-stx
436
436
#'(values accum.ty ... ))
@@ -476,37 +476,37 @@ the typed racket language.
476
476
(define-syntax (for*/lists: stx)
477
477
(syntax-parse stx
478
478
[(_ a1:optional-standalone-annotation*
479
- ((var:optionally-annotated-name) ... )
479
+ ((var:optionally-annotated-name) ... (~optional result:result-clause) )
480
480
clause:for-clauses
481
481
a2:optional-standalone-annotation*
482
482
c ... )
483
483
(define all-typed? (andmap values (attribute var.ty)))
484
484
(define for-stx
485
485
(quasisyntax/loc stx
486
- (for/lists (var.ann-name ... )
486
+ (for/lists (var.ann-name ... (~@ . (~? result ())) )
487
487
(clause.expand* ... ... )
488
488
c ... )))
489
489
((attribute a1.annotate)
490
490
((attribute a2.annotate)
491
- (if all-typed?
491
+ (if ( and all-typed? (not (attribute result)))
492
492
(add-ann for-stx #'(values var.ty ... ))
493
493
for-stx)))]))
494
494
(define-syntax (for*/fold: stx)
495
495
(syntax-parse stx #:literals (:)
496
496
[(_ a1:optional-standalone-annotation*
497
- ((var:optionally-annotated-name init:expr) ... )
497
+ ((var:optionally-annotated-name init:expr) ... (~optional result:result-clause) )
498
498
clause:for-clauses
499
499
a2:optional-standalone-annotation*
500
500
c ... )
501
501
(define all-typed? (andmap values (attribute var.ty)))
502
502
(define for-stx
503
503
(quasisyntax/loc stx
504
- (for/fold ((var.ann-name init ) ... )
504
+ (for/fold ((var.ann-name init ) ... (~@ . (~? result ())) )
505
505
(clause.expand* ... ... )
506
506
c ... )))
507
507
((attribute a1.annotate)
508
508
((attribute a2.annotate)
509
- (if all-typed?
509
+ (if ( and all-typed? (not (attribute result)))
510
510
(add-ann for-stx #'(values var.ty ... ))
511
511
for-stx)))]))
512
512
0 commit comments