aboutsummaryrefslogtreecommitdiff
path: root/module/text/flow.scm
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2022-06-12 21:09:35 +0200
committerHugo Hörnquist <hugo@lysator.liu.se>2022-06-13 04:11:35 +0200
commit73a4bfc3d8e9bb5365e33a11a6ad3b8340d5195b (patch)
treee52324edc63a240e5c0b88081c325f789168a4c5 /module/text/flow.scm
parentDocument timespec and zic. (diff)
downloadcalp-73a4bfc3d8e9bb5365e33a11a6ad3b8340d5195b.tar.gz
calp-73a4bfc3d8e9bb5365e33a11a6ad3b8340d5195b.tar.xz
Remove custom let*.
While it was nice, the most important part was the multi-valued let from srfi-71 (which is implemented in srfi-71)). The minor pattern matching structures could often be replaced with car+cdr, or a propper match.
Diffstat (limited to 'module/text/flow.scm')
-rw-r--r--module/text/flow.scm13
1 files changed, 7 insertions, 6 deletions
diff --git a/module/text/flow.scm b/module/text/flow.scm
index f7e08e1b..3b958480 100644
--- a/module/text/flow.scm
+++ b/module/text/flow.scm
@@ -7,6 +7,7 @@
:use-module (hnh util)
:use-module (text util)
:use-module (srfi srfi-1)
+ :use-module (srfi srfi-71)
)
@@ -23,12 +24,12 @@
;; str -> (str)
(define* (justify-line line #:key (width 70))
(let recur ((lst (words line)))
- (let* ((head tail (span
- (let ((w 0))
- (lambda (word) ; Take words until we are above the limit.
- (< (set/r! w = (+ 1 (true-string-length word)))
- width)))
- lst)))
+ (let ((head tail (span
+ (let ((w 0))
+ (lambda (word) ; Take words until we are above the limit.
+ (< (set/r! w = (+ 1 (true-string-length word)))
+ width)))
+ lst)))
(cond ((null? tail) (list (unwords head))) ; Don't justify last line.
((null? head)
;; an empty head implies that we found a word longer