From 20300af5f72b83827dce7d37006a66a8e20cc761 Mon Sep 17 00:00:00 2001 From: Matthew Butterick Date: Wed, 13 May 2015 18:38:58 -0700 Subject: [PATCH] and another tweak --- quad/core-types.rkt | 3 +++ quad/wrap-typed.rkt | 4 +--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/quad/core-types.rkt b/quad/core-types.rkt index 248cf8dd..75a18475 100644 --- a/quad/core-types.rkt +++ b/quad/core-types.rkt @@ -49,4 +49,7 @@ (define-predicate Index? Index) +;; Index is arguably the stricter type for Breakpoint, +;; but in practice it's annoying because doing math with Indexes +;; often leads to non-Index values. (define-type+predicate Breakpoint Nonnegative-Integer) diff --git a/quad/wrap-typed.rkt b/quad/wrap-typed.rkt index 262adb9f..3a766ae4 100644 --- a/quad/wrap-typed.rkt +++ b/quad/wrap-typed.rkt @@ -431,12 +431,10 @@ ;; bps will end up with at least two values (if all pieces fit on first line, bps = 0 and last bp) (for/fold ([bps : (Pairof Breakpoint (Listof Breakpoint)) '(0) ] [line-widths : (Listof Value-Type) empty]) - ;; (in-range (vector-length pieces)) won't work here because it doesn't preserve Index type - ([j-1 : Breakpoint (in-list (range (vector-length pieces)))]) + ([j-1 : Breakpoint (in-range (vector-length pieces))]) (define line-starting-bp (car bps)) (define line-width (get-line-width (make-trial-line pieces-rendered-widths pieces-rendered-before-break-widths - ;; add1 does not preserve Index type, so assert line-starting-bp (add1 j-1)))) (if (fl> line-width (fl* world:allowed-overfull-ratio measure)) (values (cons j-1 bps) (cons line-width line-widths))