mes: Add string-drop-right.

* module/srfi/srfi-13.mes (string-drop-right): New function.
This commit is contained in:
Jan Nieuwenhuizen 2018-01-03 06:53:02 +01:00
parent 1f8a217694
commit c5f9623c55

View file

@ -59,6 +59,10 @@
(define (string-drop s n) (define (string-drop s n)
(list->string (list-tail (string->list s) n))) (list->string (list-tail (string->list s) n)))
(define (string-drop-right s n)
(let ((length (string-length s)))
(list->string (list-head (string->list s) (- length n)))))
(define (string-delete pred s) (define (string-delete pred s)
(let ((p (if (procedure? pred) pred (let ((p (if (procedure? pred) pred
(lambda (c) (not (eq? pred c)))))) (lambda (c) (not (eq? pred c))))))