www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

commit 5e7de16a4c4f711f539bff3ea4d022354ac70587
parent 854a9b24597dedb45d938970fe64f0ea88002273
Author: Georges Dupéron <georges.duperon@gmail.com>
Date:   Thu, 11 May 2017 09:45:56 +0200

Closes #2 (foldl behaves like foldr in some cases)

Diffstat:
Mtyped-map-lib/typed-map/main.rkt | 2+-
Atyped-map-test/typed-map/test/gh-bug-2.rkt | 10++++++++++
2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/typed-map-lib/typed-map/main.rkt b/typed-map-lib/typed-map/main.rkt @@ -85,4 +85,4 @@ upcast-result))))))] [(_ f init-acc lᵢ ...) (with-syntax ([(argᵢ ...) (generate-temporaries #'(lᵢ ...))]) - #'(foldr (λ (argᵢ ... arg-acc) (f argᵢ ... arg-acc)) init-acc lᵢ ...))])) + #'(foldl (λ (argᵢ ... arg-acc) (f argᵢ ... arg-acc)) init-acc lᵢ ...))])) diff --git a/typed-map-test/typed-map/test/gh-bug-2.rkt b/typed-map-test/typed-map/test/gh-bug-2.rkt @@ -0,0 +1,9 @@ +#lang typed/racket +(require typed-map + typed/rackunit) + +(check-equal? (foldl (λ (x [acc : (Rec R (U Null (Pairof R Positive-Index)))]) + (cons acc (add1 x))) + '() + '(1 2 3)) + '(((() . 2) . 3) . 4)) +\ No newline at end of file