drop-right: srfi-13->srfi-1

This commit is contained in:
Jan (janneke) Nieuwenhuizen 2021-05-16 13:56:47 +02:00
parent ca0e5dddb6
commit 195c4b28b9
No known key found for this signature in database
GPG Key ID: F3C1A0D9C1D65273
3 changed files with 8 additions and 5 deletions

View File

@ -194,6 +194,9 @@
(lambda args
(proc (apply (apply compose rest) args)))))
(define (drop-right lst n)
(list-head lst (- (length lst) n)))
;; Hash

View File

@ -23,7 +23,8 @@
;;; Code:
(define-module (srfi srfi-1)
#:export (every
#:export (drop-right
every
find
filter
append-map
@ -50,6 +51,9 @@
reverse!
take-while))
(define (drop-right lst n)
(list-head lst (- (length lst) n)))
(define (find pred lst)
(let loop ((lst lst))
(if (null? lst) #f

View File

@ -32,7 +32,6 @@
string-split
string-take
string-drop
drop-right
string-drop-right
string-delete
string-index
@ -98,9 +97,6 @@
((> n 0) (list->string (list-tail (string->list s) n)))
(else s (error "string-drop: not supported: (n s)=" (cons n s)))))
(define (drop-right lst n)
(list-head lst (- (length lst) n)))
(define (string-drop-right s n)
(cond ((zero? n) s)
((> n 0) ((compose list->string (lambda (o) (drop-right o n)) string->list) s))