diff --git a/graph-lib/graph/queue.lp2.rkt b/graph-lib/graph/queue.lp2.rkt index 764f4c0f..3aea62b7 100644 --- a/graph-lib/graph/queue.lp2.rkt +++ b/graph-lib/graph/queue.lp2.rkt @@ -402,19 +402,38 @@ was a tag requested. (require (submod "..") typed/rackunit) - ((inst fold-queue-sets-immutable-tags - Integer - Void - String - (List 'a Integer String)) - (set 10 11 12) - (void) - (λ (e acc) (values (format "{~a}" e) acc)) - (λ (e acc x get-tag) - (let*-values ([(t1 acc1 x1) (get-tag (if (even? e) - (floor (/ e 2)) - (+ (* 3 e) 1)) - acc - x)] - [(t2 acc2 x2) (get-tag 127 acc1 x1)]) - (values (list 'a e t1) acc2 x2))))))] + (let-values + ([(h t _) + ((inst fold-queue-sets-immutable-tags + Integer + Void + String + (List 'a Integer String)) + (set 6 7) + (void) + (λ (e acc) (values (format "{~a}" e) acc)) + (λ (e acc x get-tag) + (let*-values ([(t1 acc1 x1) (get-tag (if (even? e) + (floor (/ e 2)) + (+ (* 3 e) 1)) + acc + x)] + [(t2 acc2 x2) (get-tag 85 acc1 x1)]) + (values (list 'a e t1) acc2 x2))))]) + (check-equal? (sort (hash-keys h) <) + (sort '(7 22 11 34 17 52 26 13 40 20 10 5 16 8 4 2 1 + 6 3 + 85 256 128 64 32) + <)) + (check-true (set=? (set-remove + (set-remove + (set-remove(list->set (hash-keys h)) 7) + 6) + 85) + (list->set + (map (λ ([x : (List 'a Integer String)]) + (let ([s (caddr x)]) + (string->number + (substring s 1 (- (string-length s) + 1))))) + (hash-values h))))))))] diff --git a/graph-lib/lib/__DEBUG__.rkt b/graph-lib/lib/__DEBUG__.rkt deleted file mode 100644 index bc67903c..00000000 --- a/graph-lib/lib/__DEBUG__.rkt +++ /dev/null @@ -1,36 +0,0 @@ -#lang racket -(require "low-untyped.rkt") - -(with-syntax ([((foo ...) ...) #'((aa bb cc) (x1 x2))]) - (define-temp-ids "___~a.truc" ((foo ...) ...) #:first-base fst) - (displayln (syntax->datum #'((___foo.truc ...) ...))) - (displayln (syntax->datum #'(fst ___fst.truc)))) - -(newline) - -(with-syntax ([(foo ...) #'(aa bb cc)]) - (define-temp-ids "___~a.truc" (foo ...) #:first-base fst) - (displayln (syntax->datum #'(___foo.truc ...))) - (displayln (syntax->datum #'(fst ___fst.truc)))) - -(newline) - -(with-syntax ([foo #'aa]) - (define-temp-ids "___~a.truc" foo) - (displayln (syntax->datum #'___foo.truc)) - (displayln (syntax->datum #'(fst ___fst.truc)))) - -(newline) - -(with-syntax ([((foo ...) ...) #'((aa bb cc) (x1 x2))]) - (define-temp-ids "___~a.truc" ((foo ...) ...) #:first-base fst) - (displayln (syntax->datum #'(___foo.truc ... ...))) - (displayln (syntax->datum #'(fst ___fst.truc)))) - -(newline) - -(define a 1) -(+ a a) - -(module t typed/racket - (require "low.rkt")) \ No newline at end of file diff --git a/graph-lib/lib/test-define-temp-ids.rkt b/graph-lib/lib/test-define-temp-ids.rkt new file mode 100644 index 00000000..087aab44 --- /dev/null +++ b/graph-lib/lib/test-define-temp-ids.rkt @@ -0,0 +1,26 @@ +#lang racket +(require "low-untyped.rkt") + +(with-syntax ([((foo ...) ...) #'((aa bb cc) (x1 x2))]) + (define-temp-ids "___~a.truc" ((foo ...) ...) #:first-base fst) + (syntax->datum #'((___foo.truc ...) ...)) + (syntax->datum #'(fst ___fst.truc)) + (void)) + +(with-syntax ([(foo ...) #'(aa bb cc)]) + (define-temp-ids "___~a.truc" (foo ...) #:first-base fst) + (syntax->datum #'(___foo.truc ...)) + (syntax->datum #'(fst ___fst.truc)) + (void)) + +(with-syntax ([foo #'aa]) + (define-temp-ids "___~a.truc" foo) + (syntax->datum #'___foo.truc) + (syntax->datum #'(fst ___fst.truc)) + (void)) + +(with-syntax ([((foo ...) ...) #'((aa bb cc) (x1 x2))]) + (define-temp-ids "___~a.truc" ((foo ...) ...) #:first-base fst) + (syntax->datum #'(___foo.truc ... ...)) + (syntax->datum #'(fst ___fst.truc)) + (void))