From 8499defa8a8071873c678b1bf3664322dfc1f009 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Georges=20Dup=C3=A9ron?= Date: Thu, 20 Apr 2017 14:55:14 +0200 Subject: [PATCH] =?UTF-8?q?Renamed=20worklist=20=E2=86=92=20worklist-funct?= =?UTF-8?q?ion=20and=20work=20=E2=86=92=20worklist?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- experiment.rkt | 14 +++++++------- test/test-experiment.rkt | 26 +++++++++++++------------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/experiment.rkt b/experiment.rkt index 0d9792d..b0bddbb 100644 --- a/experiment.rkt +++ b/experiment.rkt @@ -1,12 +1,12 @@ #lang typed/racket -(provide work) +(provide worklist) (require (only-in type-expander unsafe-cast)) ;; TODO: write a macro wrapper which does the unsafe-cast (until the bug in TR ;; is fixed), and (un)wraps the inputs and outputs. -(provide worklist) +(provide worklist-function) (struct (A) I ([v : A]) #:transparent) (struct (A) O ([v : A]) #:transparent) @@ -55,13 +55,13 @@ (define-type I* (I Any)) (define-type O* (O Any)) -(: worklist +(: worklist-function (∀ (A ...) (case→ (→ (List (Listof (∩ A I*)) ...) (List (→ (∩ A I*) (List (∩ A O*) (Listof (∩ A I*)) ...)) ...) (List (Listof (Pairof (∩ A I*) (∩ A O*))) ...))))) -(define (worklist roots processors) +(define (worklist-function roots processors) (define nulls (map (λ (_) (ann '() (Listof Nothing))) processors)) (define empty-sets (map list->set nulls)) @@ -113,7 +113,7 @@ (define-syntax-rule (inst-worklist (In Out) ...) (unsafe-cast - (inst worklist + (inst worklist-function (U (I In) (O Out)) ...) ;; cast to its own type, circumventing the fact that TR doesn't seem to apply @@ -167,14 +167,14 @@ ...) new-l)) -(define-syntax-rule (work roots (proc ...) (In Out) ... ) +(define-syntax-rule (worklist roots (proc ...) (In Out) ... ) (unwrap-io ((inst-worklist (In Out) ...) (i** roots) (list (wrap-io proc) ...)) (proc 'dummy) ...)) -(work (list (list 7) +(worklist (list (list 7) (list)) [(λ ([x : Integer]) (list (number->string x) diff --git a/test/test-experiment.rkt b/test/test-experiment.rkt index 02f8029..8e3af97 100644 --- a/test/test-experiment.rkt +++ b/test/test-experiment.rkt @@ -1,16 +1,16 @@ #lang typed/racket (require "../experiment.rkt") -(work (list (list 7) - (list)) - [(λ ([x : Integer]) - (list (number->string x) - (list (if (> x 0) (sub1 x) 0)) - (list (string->symbol - (string-append "v" (number->string x)))))) - (λ ([x : Symbol]) - (list (eq? 'v5 x) - (list 10) - (list 'xyz)))] - (Integer String) - (Symbol Boolean)) \ No newline at end of file +(worklist (list (list 7) + (list)) + [(λ ([x : Integer]) + (list (number->string x) + (list (if (> x 0) (sub1 x) 0)) + (list (string->symbol + (string-append "v" (number->string x)))))) + (λ ([x : Symbol]) + (list (eq? 'v5 x) + (list 10) + (list 'xyz)))] + (Integer String) + (Symbol Boolean)) \ No newline at end of file