diff options
author | Bryan Newbold <bnewbold@robocracy.org> | 2017-02-20 00:05:38 -0800 |
---|---|---|
committer | Bryan Newbold <bnewbold@robocracy.org> | 2017-02-20 00:05:38 -0800 |
commit | 64f037d91e0c9296dcaef9a0ff3eb33b19a2ed34 (patch) | |
tree | 1b23b8e8005328194e2fb4bf653806c85050933f /srfi-1.scm | |
parent | 5bea21e81ed516440e34e480f2c33ca41aa8c597 (diff) | |
download | slib-64f037d91e0c9296dcaef9a0ff3eb33b19a2ed34.tar.gz slib-64f037d91e0c9296dcaef9a0ff3eb33b19a2ed34.zip |
Import Upstream version 3a5upstream/3a5
Diffstat (limited to 'srfi-1.scm')
-rw-r--r-- | srfi-1.scm | 17 |
1 files changed, 13 insertions, 4 deletions
@@ -253,8 +253,17 @@ (f l (pair-fold-right f z (cdr l))))) ;;@body -(define (reduce f ridentity list) - (if (null? list) ridentity (fold f (car list) (cdr list)))) +(define reduce + (let ((comlist-reduce reduce)) + (lambda args + (apply (if (= 2 (length args)) + comlist-reduce + (lambda (f ridentity list) + (if (null? list) + ridentity + (fold f (car list) (cdr list))))) + args)))) + (define (reduce-right f ridentity list) (if (null? list) ridentity @@ -333,11 +342,11 @@ ;;@args pred list (define remove - (let ((comlist:remove remove)) + (let ((comlist-remove remove)) (lambda (pred l) (if (procedure? pred) (filter (lambda (x) (not (pred x))) l) - (comlist:remove pred l))))) ; 'remove' has incompatible semantics in comlist of SLIB! + (comlist-remove pred l))))) ; 'remove' has incompatible semantics in comlist of SLIB! ;;@args pred list (define (partition! p? l) |