From b2bdb030614f1d233b550a63fd34e3727ba33dfb Mon Sep 17 00:00:00 2001 From: Matthew Butterick Date: Thu, 23 Jun 2016 22:28:42 -0700 Subject: [PATCH] simplify another loop --- hyphenate/hyphenate/private/core.rkt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hyphenate/hyphenate/private/core.rkt b/hyphenate/hyphenate/private/core.rkt index 772439c7..d69c8add 100644 --- a/hyphenate/hyphenate/private/core.rkt +++ b/hyphenate/hyphenate/private/core.rkt @@ -145,9 +145,9 @@ idx)) ;; the hyphenation goes after the indexed letter, so add1 to the raw points for slicing - (define odd-points-plus-one (map add1 odd-points)) - (for/list ([start (in-list (cons 0 odd-points-plus-one))] - [end (in-list (append odd-points-plus-one (list (string-length word))))]) + (define breakpoints (append (list 0) (map add1 odd-points) (list (string-length word)))) + (for/list ([start (in-list breakpoints)] + [end (in-list (cdr breakpoints))]) ; shorter list controls exit of loop (substring word start end))]))