From 9c36db09b9a19cd70dfcc1ccce58f137df296d95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Wed, 24 Apr 2019 19:47:33 +0200 Subject: Remove take-drop-while, span already in SRFI-1. --- module/output/text.scm | 2 +- module/util.scm | 10 ---------- 2 files changed, 1 insertion(+), 11 deletions(-) diff --git a/module/output/text.scm b/module/output/text.scm index 274c79e2..5d8248f4 100644 --- a/module/output/text.scm +++ b/module/output/text.scm @@ -31,7 +31,7 @@ ;; str -> (str) (define* (justify-line line #:key (width 70)) (let recur ((lst (words line))) - (let* ((head tail (take-drop-while + (let* ((head tail (span (let ((w 0)) (lambda (word) ; Take words until we are above the limit. (< (mod/r! w = (+ 1 (string-length word))) diff --git a/module/util.scm b/module/util.scm index 9673288d..d1bdfca1 100644 --- a/module/util.scm +++ b/module/util.scm @@ -327,16 +327,6 @@ (append done ((if (list? subl) flatten list) subl))) '() lst)) -;; Retuns two values. The longset head which satisfies @var{pred?}, -;; and the rest of the elements of list. -;; Guarentees to only call @var{pred?} once for each element. -(define-public (take-drop-while pred? list) - (let loop ((done '()) (rem list)) - (cond ((null? rem) (values (reverse done) '())) - ((pred? (car rem)) (loop (cons (car rem) done) (cdr rem))) - (else (values (reverse done) rem))))) - - (define* (tree-map proc tree #:key (descend (const #t))) (cond ((not (list? tree)) (proc tree)) ((null? tree) '()) -- cgit v1.2.3