diff --git a/graph/graph/__DEBUG_graph__.rkt b/graph/graph/__DEBUG_graph__.rkt index 3957b88d..1806a6d8 100644 --- a/graph/graph/__DEBUG_graph__.rkt +++ b/graph/graph/__DEBUG_graph__.rkt @@ -21,6 +21,7 @@ (require (submod "graph3.lp2.rkt" test)) (require "graph3.lp2.rkt") (require "graph4.lp2.rkt") +(require "map.rkt") (require "structure.lp2.rkt") (require "variant.lp2.rkt") (require "../lib/low.rkt") diff --git a/graph/graph/fold-queues.lp2.rkt b/graph/graph/fold-queues.lp2.rkt index 919db04b..c93cdaba 100644 --- a/graph/graph/fold-queues.lp2.rkt +++ b/graph/graph/fold-queues.lp2.rkt @@ -293,9 +293,7 @@ added to the @tc[Δ-Hash] since its creation from a simple @tc[HashTable]. (require (submod "..") typed/rackunit) - ; TODO - - (require (submod ".." doc)))] + #| TODO |#)] @chunk[<*> (begin diff --git a/graph/graph/graph.lp2.rkt b/graph/graph/graph.lp2.rkt index ed08d66f..42a3b6fb 100644 --- a/graph/graph/graph.lp2.rkt +++ b/graph/graph/graph.lp2.rkt @@ -881,6 +881,4 @@ checker, unless it is absorbed by a larger type, like in ;; - - - (require (submod ".." doc))))] \ No newline at end of file + ))] diff --git a/graph/graph/graph2.lp2.rkt_ b/graph/graph/graph2.lp2.rkt_ index d6c70577..2b19a215 100644 --- a/graph/graph/graph2.lp2.rkt_ +++ b/graph/graph/graph2.lp2.rkt_ @@ -606,9 +606,7 @@ to return an incomplete node type. - g - - (require (submod ".." doc)))] + g)] @chunk[<*> (begin diff --git a/graph/graph/graph3.lp2.rkt b/graph/graph/graph3.lp2.rkt index d0f6e319..a82148b3 100644 --- a/graph/graph/graph3.lp2.rkt +++ b/graph/graph/graph3.lp2.rkt @@ -646,9 +646,7 @@ not match the one from @tc[typed/racket] typed/rackunit) (provide g) - - - (require (submod ".." doc)))] + )] @chunk[<*> (begin @@ -657,4 +655,4 @@ not match the one from @tc[typed/racket] (require 'main) (provide (all-from-out 'main)) - )] \ No newline at end of file + )] diff --git a/graph/graph/graph4.lp2.rkt b/graph/graph/graph4.lp2.rkt index 287823cd..b037dae5 100644 --- a/graph/graph/graph4.lp2.rkt +++ b/graph/graph/graph4.lp2.rkt @@ -225,9 +225,7 @@ The type for the function generated by @tc[λget] mirrors the cases from (require (submod "..") typed/rackunit) - - - (require (submod ".." doc)))] + )] @chunk[<*> (begin diff --git a/graph/graph/map.rkt b/graph/graph/map.rkt index 0701973f..1bdf77da 100644 --- a/graph/graph/map.rkt +++ b/graph/graph/map.rkt @@ -58,12 +58,12 @@ fun-in fun-out] …) #:funs [fun …])))) -(define-for-syntax (:map* stx* stx-&l… stx-out) +(define-for-syntax (:map* stx* stx-&ls stx-out) (if (stx-null? stx*) '() - (syntax-parse (:map (stx-car stx*) stx-&l… stx-out) + (syntax-parse (:map (stx-car stx*) stx-&ls stx-out) [info:map-info - (let ([r (:map* (stx-cdr stx*) stx-&l… #'info.in-type)] + (let ([r (:map* (stx-cdr stx*) stx-&ls #'info.in-type)] [auto (attribute info.auto-in)]) (if (and (not (null? auto)) (car auto) (not (null? r))) (syntax-parse (car r) @@ -85,8 +85,8 @@ r))]) (cons #'info r)))]))) -(define-for-syntax (:map stx stx-&l… stx-out) - (define/with-syntax (&l …) stx-&l…) +(define-for-syntax (:map stx stx-&ls stx-out) + (define/with-syntax (&l …) stx-&ls) (define/with-syntax out stx-out) (syntax-parse (remove-identities1 stx) [(~literal car) @@ -140,9 +140,9 @@ [(_ [f … f-last] [a …]) #'(apply-compose [f …] [(f-last a …)])])) -(define-for-syntax (internal-map: stx-f stx-&l… stx-out) +(define-for-syntax (internal-map: stx-f stx-&ls stx-out) (define/with-syntax f stx-f) - (define/with-syntax (&l …) stx-&l…) + (define/with-syntax (&l …) stx-&ls) (define/with-syntax out stx-out) (syntax-parse (:map #'f #'(&l …) #'out) [(~and i :map-info) @@ -171,34 +171,123 @@ #'(ann '(code arg-fun … l …) Any) #'(code arg-fun … l …))])])) -(map: add1 '(1 2 3)) -(map: (compose add1) '(1 2 3)) -(map: (∘ identity add1) '(1 2 3)) -(map: (∘ add1 identity) '(1 2 3)) -(map: (∘ number->string add1) '(1 2 9)) -(map: (∘ string-length number->string add1) '(1 2 9)) -(map: car '((1 2) (2) (9 10 11))) -(map: (∘ add1 car) '((1 2) (2) (9 10 11))) -(map: (∘ string-length number->string add1 car cdr) - '((1 2) (2 3) (9 10 11))) -(map: identity '(1 2 3)) -(map: values '(1 2 3)) -(map: (compose) '(1 2 3)) -(map: (compose identity) '(1 2 3)) -(map: (∘ identity values identity values) '(1 2 3)) -(map: (∘ length (curry map add1)) '((1 2) (3))) - -(map: (curry map add1) '((1 2) (3))) - -(define (numlist [x : Number]) (list x)) -(map: (∘ (curry map add1) numlist) '(1 2 3)) -(map: (∘ (curry map add1) (λ ([x : Number]) (list x))) '(1 2 3)) - - (module* test typed/racket (require (submod "..") "../lib/low.rkt") + (check-equal?: (map: add1 '(1 2 3)) + : (Listof Number) + '(2 3 4)) + (check-equal?: (map: (compose add1) '(1 2 3)) + : (Listof Number) + '(2 3 4)) + (check-equal?: (map: (∘ identity add1) '(1 2 3)) + : (Listof Number) + '(2 3 4)) + (check-equal?: (map: (∘ add1 identity) '(1 2 3)) + : (Listof Number) + '(2 3 4)) + (check-equal?: (map: (∘ number->string add1) '(1 2 9)) + : (Listof String) + '("2" "3" "10")) + (check-equal?: (map: (∘ string-length number->string add1) '(1 2 9)) + : (Listof Number) + '(1 1 2)) + (check-equal?: (map: car '((1 2) (2) (9 10 11))) + : (Listof Number) + '(1 2 9)) + (check-equal?: (map: (∘ add1 car) '((1 2) (2) (9 10 11))) + : (Listof Number) + '(2 3 10)) + (check-equal?: (map: (∘ string-length number->string add1 car cdr) + '((1 2) (2 3) (8 9 10))) + : (Listof Number) + '(1 1 2)) + (check-equal?: (map: identity '(1 2 3)) + : (Listof Number) + '(1 2 3)) + (check-equal?: (map: values '(1 2 3)) + : (Listof Number) + '(1 2 3)) + (check-equal?: (map: (compose) '(1 2 3)) + : (Listof Number) + '(1 2 3)) + (check-equal?: (map: (compose identity) '(1 2 3)) + : (Listof Number) + '(1 2 3)) + (check-equal?: (map: (∘ identity values identity values) '(1 2 3)) + : (Listof Number) + '(1 2 3)) + (check-equal?: (map: (∘ length (curry map add1)) '((1 2) (3))) + : (Listof Number) + '(2 1)) + (check-equal?: (map: (curry map add1) '((1 2) (3))) + : (Listof (Listof Number)) + '((2 3) (4))) + + (define (numlist [x : Number]) (list x)) + (check-equal?: (map: (∘ (curry map add1) numlist) '(1 2 3)) + : (Listof (Listof Number)) + '((2) (3) (4))) + + (check-equal?: (map: (∘ (curry map add1) (λ ([x : Number]) (list x))) + '(1 2 3)) + : (Listof (Listof Number)) + '((2) (3) (4))) + + ;; The tests below using (curry map: …) don't work, because typed/racket wraps + ;; the map: identifier with a contract, so the identifier seen outside the + ;; module is not the same as the one used in the syntax-parse ~literal clause. + + #;(begin + (check-equal?: (map: (curry map add1) '((1 2 3) (4 5))) + : (Listof (Listof Number)) + '((2 3 4) (5 6))) + #;(check-equal?: (map: (curry map: add1) '((1 2 3) (4 5))) + : (Listof (Listof Number)) + '((2 3 4) (5 6))) + + (check-equal?: (map: (curry map (compose number->string add1)) + '((1 2 3) (4 5))) + : (Listof (Listof String)) + '(("2" "3" "4") ("5" "6"))) + #;(check-equal?: (map: (curry map: (compose number->string add1)) + '((1 2 3) (4 5))) + : (Listof (Listof String)) + '(("2" "3" "4") ("5" "6"))) + + (check-equal?: (map: add1 '(1 2 3)) + : (Listof Number) + '(2 3 4)) + + (check-equal?: (map: car '((1 a) (2 b) (3 c))) + : (Listof Number) + '(1 2 3)) + + (check-equal?: (map: (curry map car) '([(1 a) (2 b)] [(3 c)])) + : (Listof Number) + '((1 a) (3 c))) + #;(check-equal?: (map: (curry map: car) '([(1 a) (2 b)] [(3 c)])) + : (Listof Number) + '((1 a) (3 c))) + + (check-equal?: (map: (curry map (curry map car)) + '([((1 a) (2 b)) ((3 c))] [((4))])) + : (Listof (Listof (Listof Number))) + '([(1 2) (3)] [(4)])) + #;(check-equal?: (map: (curry map (curry map: car)) + '([((1 a) (2 b)) ((3 c))] [((4))])) + : (Listof (Listof (Listof Number))) + '([(1 2) (3)] [(4)])) + #;(check-equal?: (map: (curry map: (curry map car)) + '([((1 a) (2 b)) ((3 c))] [((4))])) + : (Listof (Listof (Listof Number))) + '([(1 2) (3)] [(4)])) + #;(check-equal?: (map: (curry map: (curry map: car)) + '([((1 a) (2 b)) ((3 c))] [((4))])) + : (Listof (Listof (Listof Number))) + '([(1 2) (3)] [(4)]))) + (check-equal?: (map: car '((1 b x) (2 c) (3 d))) : (Listof Number) '(1 2 3)) @@ -338,141 +427,3 @@ EDIT: that's what we did, using the #:auto-in |# - - - - - - - - - -#| - -#;#'(let () - (: map2 (∀ (poly-types …) (→ function-types … - (Listof (Listof A)) - (Listof (Listof D))))) - (define (map2 f … l) - (if (null? l) - '() - (cons (map1 f … (car l)) - (map2 f … (cdr l))))) - (map2 f … l)) - -; (map: (curry map add1) '((1 2 3) (4 5))) => -; (map: (curry map: add1) '((1 2 3) (4 5))) => -(let () - (: map2 (∀ (A C) (→ (→ A C) - (Listof (Listof A)) - (Listof (Listof C))))) - (define (map2 f l) - (if (null? l) '() (cons (map f (car l)) (map2 f (cdr l))))) - (map2 add1 '((1 2 3) (4 5)))) - -;; TODO: -; (map: (compose (curry map (compose list add1)) -; (curry map (compose add1 add1))) -; '((1 2 3) (4 5))) -; => -#;??? - -; (map: (curry map (compose number->string add1)) '((1 2 3) (4 5))) => -; (map: (curry map: (compose number->string add1)) '((1 2 3) (4 5))) => -(let () - (: map2 (∀ (A C D) (→ (→ A C) - (→ C D) - (Listof (Listof A)) - (Listof (Listof D))))) - (define (map2 f g l) - (if (null? l) - '() - (cons ;(map1 f g (car l)) - ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - (let () - (: map1 (∀ (A C D) (→ (→ A C) - (→ C D) - (Listof A) - (Listof D)))) - (define (map1 f g l) - (if (null? l) '() (cons (g (f (car l))) (map1 f g (cdr l))))) - (map1 f g (car l))) - ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - (map2 f g (cdr l))))) - (map2 add1 number->string '((1 2 3) (4 5)))) - -; (map: add1 '(1 2 3)) -(let () - (: map1 (∀ (A C) (→ (→ A C) - (Listof A) - (Listof C)))) - (define (map1 f l) - (if (null? l) '() (cons (f (car l)) (map1 f (cdr l))))) - (map1 add1 '(1 2 3))) - -; (map: car '((1 a) (2 b) (3 c))) -(let () - (: map1 (∀ (A B) (→ (→ (Pairof A B) A) - (Listof (Pairof A B)) - (Listof A)))) - (define (map1 f l) - (if (null? l) '() (cons (f (car l)) (map1 f (cdr l))))) - (map1 car - '((1 a) (2 b) (3 c)))) - -; (map: (curry map car) '([(1 a) (2 b)] [(3 c)])) -; (map: (curry map: car) '([(1 a) (2 b)] [(3 c)])) -(let () - (: map1 (∀ (A B) (→ (→ (Pairof A B) A) - (Listof (Pairof A B)) - (Listof A)))) - (define (map1 f l) - (if (null? l) '() (cons (f (car l)) (map1 f (cdr l))))) - - (: map2 (∀ (A B) (→ (→ (Pairof A B) A) - (Listof (Listof (Pairof A B))) - (Listof (Listof A))))) - (define (map2 f l) - (if (null? l) '() (cons (map1 f (car l)) (map2 f (cdr l))))) - - (map2 car - '([(1 a) (2 b)] [(3 c)]))) - -; (map: (curry map (curry map car)) '([(1 a) (2 b)] [(3 c)])) -; (map: (curry map (curry map: car)) '([(1 a) (2 b)] [(3 c)])) -; (map: (curry map: (curry map car)) '([(1 a) (2 b)] [(3 c)])) -; (map: (curry map: (curry map: car)) '([(1 a) (2 b)] [(3 c)])) -(let () - (: map3 (∀ (A B) (→ ;(→ (Pairof A B) A) - (Listof (Listof (Listof (Pairof A B)))) - (Listof (Listof (Listof A)))))) - (define (map3 #|f|# l) - (if (null? l) - '() - (cons (let () - (: map2 (∀ (A B) (→ ;(→ (Pairof A B) A) - (Listof (Listof (Pairof A B))) - (Listof (Listof A))))) - (define (map2 #|f|# l) - (if (null? l) - '() - (cons (let () - (: map1 (∀ (A B) (→ ;(→ (Pairof A B) A) - (Listof (Pairof A B)) - (Listof A)))) - (define (map1 #|f|# l) - (if (null? l) - '() - (cons (#|f|#car (car l)) - (map1 #|f|# (cdr l))))) - (map1 #|f|# (car l))) - (map2 #|f|# (cdr l))))) - (map2 #|f|# (car l))) - (map3 #|f|# (cdr l))))) - (map3 ;car - '([[(1 a) (2 b)] [(3 c)]] [[(4 d)]]))) - -;(define-syntax-rule (inst-∀ T …) - - -|# \ No newline at end of file diff --git a/graph/graph/queue.lp2.rkt b/graph/graph/queue.lp2.rkt index 5ad450ec..764f4c0f 100644 --- a/graph/graph/queue.lp2.rkt +++ b/graph/graph/queue.lp2.rkt @@ -417,6 +417,4 @@ was a tag requested. acc x)] [(t2 acc2 x2) (get-tag 127 acc1 x1)]) - (values (list 'a e t1) acc2 x2)))) - - (require (submod ".." doc))))] \ No newline at end of file + (values (list 'a e t1) acc2 x2))))))] diff --git a/graph/graph/rewrite-type.lp2.rkt b/graph/graph/rewrite-type.lp2.rkt index 2fd0ff4d..c0747b47 100644 --- a/graph/graph/rewrite-type.lp2.rkt +++ b/graph/graph/rewrite-type.lp2.rkt @@ -633,6 +633,4 @@ These metafunctions just extract the arguments for @tc[replace-in-type] and - - - (require (submod ".." doc))))] \ No newline at end of file + ))] diff --git a/graph/graph/structure.lp2.rkt b/graph/graph/structure.lp2.rkt index 20046f8a..ede2badf 100644 --- a/graph/graph/structure.lp2.rkt +++ b/graph/graph/structure.lp2.rkt @@ -650,9 +650,7 @@ chances that we could write a definition for that identifier. - - - (require (submod ".." doc))))] + ))] @section{Optimizing access to fields} diff --git a/graph/graph/variant.lp2.rkt b/graph/graph/variant.lp2.rkt index 568fb16d..bda4d95d 100644 --- a/graph/graph/variant.lp2.rkt +++ b/graph/graph/variant.lp2.rkt @@ -309,6 +309,4 @@ number of name collisions. - - - (require (submod ".." doc))))] \ No newline at end of file + ))] diff --git a/graph/lib/doc/example.lp2.rkt b/graph/lib/doc/example.lp2.rkt index f35d82f4..1e6edf33 100644 --- a/graph/lib/doc/example.lp2.rkt +++ b/graph/lib/doc/example.lp2.rkt @@ -43,9 +43,7 @@ Blah @math{n}, as described by M@._ Foo@.__ (module* test racket (require (submod "..")) (require rackunit) - (check-equal? (foo) "foo") - - (require (submod ".." doc)))] + (check-equal? (foo) "foo"))] It would be nice to be able to alter existing chunks, by inserting stuff later, for example: @@ -60,4 +58,4 @@ But we would actually want: (define-syntax-rule (double x) -- should be greyed out (let ((x-cache x)) (+ x-cache x-cache))) -- everything except the changed bits should - -- be greyed out] \ No newline at end of file + -- be greyed out] diff --git a/graph/lib/doc/template.lp2.rkt b/graph/lib/doc/template.lp2.rkt index b919af00..c330dad8 100644 --- a/graph/lib/doc/template.lp2.rkt +++ b/graph/lib/doc/template.lp2.rkt @@ -62,9 +62,7 @@ scribble, see (require (submod "..") typed/rackunit) - - - (require (submod ".." doc)))] + )] @chunk[<*> (begin @@ -73,4 +71,4 @@ scribble, see (require 'main) (provide (all-from-out 'main)) - )] \ No newline at end of file + )] diff --git a/graph/make/make.rkt b/graph/make/make.rkt index 32f11cee..e715fb53 100644 --- a/graph/make/make.rkt +++ b/graph/make/make.rkt @@ -201,5 +201,7 @@ (run! `(,(find-executable-path-or-fail "raco") "cover" + "-s" "doc" + "-s" "test" "-v" ,@(exclude-dirs rkt-files (list "make/")))) diff --git a/graph/type-expander/multi-id.lp2.rkt b/graph/type-expander/multi-id.lp2.rkt index 8c1f8643..27cc71ff 100644 --- a/graph/type-expander/multi-id.lp2.rkt +++ b/graph/type-expander/multi-id.lp2.rkt @@ -211,6 +211,4 @@ Test with @tc[#:else]: typed/rackunit (for-syntax racket/list)) - - - (require (submod ".." doc))))] \ No newline at end of file + ))] diff --git a/graph/type-expander/type-expander.lp2.rkt b/graph/type-expander/type-expander.lp2.rkt index 90226112..d92f7bd1 100644 --- a/graph/type-expander/type-expander.lp2.rkt +++ b/graph/type-expander/type-expander.lp2.rkt @@ -483,7 +483,8 @@ them. '(2 "abc" #,(x . z) #(1 "b" x) d)) (check-equal?: (ann d0 (List 2 "abc" - (List 'unsyntax (Pairof (U 'x 'y) (U 'y 'z))) + (List 'unsyntax + (Pairof (U 'x 'y) (U 'y 'z))) (Vector 1 "b" 'x) 'd)) '(2 "abc" (unsyntax (x . z)) #(1 "b" x) d)) @@ -614,6 +615,9 @@ them. [proc : (tmpl-expand-type () proc-type)]))]))] @chunk[ + (define TODO '(bug in version 20160114-9498bdd + racket-6.4.0.1-i386-linux-precise.sh)) + #| (define-struct/exec se0 () ;[(λ (self v) (cons self v)) : (∀ (A) (→ se0 A (Pairof se0 A)))]) [(λ (self v) (cons self v)) : (→ se0 Any (Pairof se0 Any))]) @@ -669,7 +673,8 @@ them. 24) (check-not-exn (λ () (ann (car ((se3 4 5 "f") 'd 'e)) se2))) (check-true (se2? (car ((se3 4 5 "f") 'd 'e)))) - (check-true (se3? (car ((se3 4 5 "f") 'd 'e))))] + (check-true (se3? (car ((se3 4 5 "f") 'd 'e)))) + |#] @subsection{@racket[ann]} @@ -1081,7 +1086,7 @@ And, last but not least, we will add a @tc[test] module. -|# + |# ; #| @@ -1091,10 +1096,7 @@ And, last but not least, we will add a @tc[test] module. -|# - - ;; Make the code coverage take the docs into account. - (require (submod ".." doc)))] + |#)] We can now assemble the modules in this order: