simplify another loop

main
Matthew Butterick 8 years ago
parent 509116fdda
commit b2bdb03061

@ -145,9 +145,9 @@
idx)) idx))
;; the hyphenation goes after the indexed letter, so add1 to the raw points for slicing ;; the hyphenation goes after the indexed letter, so add1 to the raw points for slicing
(define odd-points-plus-one (map add1 odd-points)) (define breakpoints (append (list 0) (map add1 odd-points) (list (string-length word))))
(for/list ([start (in-list (cons 0 odd-points-plus-one))] (for/list ([start (in-list breakpoints)]
[end (in-list (append odd-points-plus-one (list (string-length word))))]) [end (in-list (cdr breakpoints))]) ; shorter list controls exit of loop
(substring word start end))])) (substring word start end))]))

Loading…
Cancel
Save