From b3c746276a940c39fe4be32a906fd4aceda5a60b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Georges=20Dup=C3=A9ron?= Date: Wed, 18 Nov 2015 20:08:08 +0100 Subject: [PATCH] Used ~a instead of string-append, to concatenate long lines. --- graph/graph/graph2.lp2.rkt | 20 +++++++++++++++++++- graph/graph/queue.lp2.rkt | 9 +++++---- graph/graph/rewrite-type.lp2.rkt | 5 +++-- graph/type-expander/type-expander.lp2.rkt | 14 +++++++------- 4 files changed, 34 insertions(+), 14 deletions(-) diff --git a/graph/graph/graph2.lp2.rkt b/graph/graph/graph2.lp2.rkt index a908ed6..29d744a 100644 --- a/graph/graph/graph2.lp2.rkt +++ b/graph/graph/graph2.lp2.rkt @@ -295,7 +295,7 @@ The code above needs some identifiers derived from @tc[mapping] names: @subsection{Making with-promises nodes} -We derive the @tc[with-promises] type from each @emph{ideal} node type, using +We derive the @tc[with-promises] type from each @emph{ideal} node type using the @tc[tmpl-replace-in-type] template metafunction from the rewrite-type library. We replace all occurrences of a @tc[node] name with a @tc[Promise] for that node's @tc[with-promises] type. @@ -311,6 +311,24 @@ that node's @tc[with-promises] type. (define-temp-ids "~a/make-with-promises" (node ...)) (define-temp-ids "~a/with-promises-type" (node ...))] +@subsection{Making incomplete nodes} + +We derive the @tc[incomplete] type from each @emph{ideal} node type using +the @tc[tmpl-replace-in-type] template metafunction from the rewrite-type +library. We replace all occurrences of a @tc[node] name with a union of the +node's @tc[incomplete] type, and all compatible @tc[placeholder] types. + +@; TODO: use a type-expander here, instead of a template metafunction. + +@CHUNK[ + (define-type node/incomplete-type + (tmpl-replace-in-type (List 'node field-type ...) + ([node (U node/incomplete-type + mapping/placeholder-type ...)] ...)))] + +@chunk[ + (define-temp-ids "~a/make-with-promises" (node ...)) + (define-temp-ids "~a/with-promises-type" (node ...))] @subsection{Processing the placeholders} diff --git a/graph/graph/queue.lp2.rkt b/graph/graph/queue.lp2.rkt index ef29717..637447b 100644 --- a/graph/graph/queue.lp2.rkt +++ b/graph/graph/queue.lp2.rkt @@ -201,9 +201,9 @@ as values. (list (set-add past-queue element) (combine-results element result result-acc) #;(if (hash-has-key? result-hash element) - (error (string-append - "Duplicate key in fold-queue-sets." - "Are you using mutable elements?")) + (error (~a "Duplicate key " element + " in fold-queue-sets." + "Are you using mutable elements?")) (hash-set result-hash element result)) new-acc))))] @@ -372,7 +372,8 @@ was a tag requested. racket/syntax "../lib/low-untyped.rkt") "../lib/low.rkt" - racket/set) + racket/set + racket/format) (provide fold-queue map-queue diff --git a/graph/graph/rewrite-type.lp2.rkt b/graph/graph/rewrite-type.lp2.rkt index 14a73c1..92a4c53 100644 --- a/graph/graph/rewrite-type.lp2.rkt +++ b/graph/graph/rewrite-type.lp2.rkt @@ -1,6 +1,7 @@ #lang debug scribble/lp2 @(require "../lib/doc.rkt") @doc-lib-setup +@(require racket/format) @title[#:style manual-doc-style]{Rewriting data structures and their types} @@ -246,8 +247,8 @@ Handling freer forms of unions causes some problems: These issues and possible solutions are addressed in more detail in the -@hyperlink[(string-append "https://phc.fogbugz.com/f/cases/54/" - "Rethink-how-to-do-the-multi-step-types-more-inside")] +@hyperlink[(~a "https://phc.fogbugz.com/f/cases/54/" + "Rethink-how-to-do-the-multi-step-types-more-inside")] {FogBugz case 54}. @section[#:tag "sec:fold"]{Folding over an instance} diff --git a/graph/type-expander/type-expander.lp2.rkt b/graph/type-expander/type-expander.lp2.rkt index 9510d8e..79f6196 100644 --- a/graph/type-expander/type-expander.lp2.rkt +++ b/graph/type-expander/type-expander.lp2.rkt @@ -39,10 +39,9 @@ contain the expander procedure, or directly an expander procedure. [else (raise-argument-error 'prop:type-expander-guard - (string-append - "an exact non-negative integer designating a field index " - "within the structure that should contain a procedure of " - "arity 1, or a procedure of arity 1.") + (~a "an exact non-negative integer designating a field index " + "within the structure that should contain a procedure of " + "arity 1, or a procedure of arity 1.") val)]))] If the value is a field index, it should be within bounds. The @@ -832,9 +831,10 @@ in @tc[racket], not @tc[typed/racket]). @chunk[ (module expander racket - (require racket) - (require syntax/parse) - (require syntax/stx) + (require racket + syntax/parse + syntax/stx + racket/format) (require (for-template typed/racket))