Mathieu Lirzin <m...@gnu.org> writes: > IMO It would be nice if multiple values > were handled too. here is one solution inspired by ‘compose’. > > (define and=> > (case-lambda > ((val proc) (and val (proc val))) > ((val proc . procs) > (let loop ((p proc) (ps procs)) > (if (null? ps) > (p val) > (loop (lambda args > (call-with-values (lambda () (apply p args)) > (lambda (arg0 . args*) > (and arg0 (apply (car ps) arg0 args*))))) > (cdr ps)))))))
This generalization will inevitably slow it down, and it's not clear that this is useful in practice. It's also not particularly natural, because these return value(s) somehow need to be interpreted as a boolean. There are multiple ways to do that, and it's not clear which is the best way. I think we should resist the temptation to make simple things more complicated without good reason. Making things more complicated always has a cost. I'm a big believer in keeping things simple, especially the widely used primitive operations. Thoughts? Mark