1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-11 22:31:12 +02:00

lambda* in string-any, string-every

* module/ice-9/boot-9.scm (string-any, string-every): Use lambda*.
This commit is contained in:
Andy Wingo 2010-05-21 23:34:06 +02:00
parent f31b7b6a1c
commit a4c8a02e09

View file

@ -294,11 +294,8 @@ If there is no handler at all, Guile prints an error and then exits."
;; this is scheme wrapping the C code so the final pred call is a tail call,
;; per SRFI-13 spec
(define (string-any char_pred s . rest)
(let ((start (if (null? rest)
0 (car rest)))
(end (if (or (null? rest) (null? (cdr rest)))
(string-length s) (cadr rest))))
(define string-any
(lambda* (char_pred s #:optional (start 0) (end (string-length s)))
(if (and (procedure? char_pred)
(> end start)
(<= end (string-length s))) ;; let c-code handle range error
@ -308,11 +305,8 @@ If there is no handler at all, Guile prints an error and then exits."
;; this is scheme wrapping the C code so the final pred call is a tail call,
;; per SRFI-13 spec
(define (string-every char_pred s . rest)
(let ((start (if (null? rest)
0 (car rest)))
(end (if (or (null? rest) (null? (cdr rest)))
(string-length s) (cadr rest))))
(define string-every
(lambda* (char_pred s #:optional (start 0) (end (string-length s)))
(if (and (procedure? char_pred)
(> end start)
(<= end (string-length s))) ;; let c-code handle range error