Add further conversions between data-directed and code-directed programming idioms
Marc Nieper-Wißkirchen 06 Jun 2020 17:25 UTC
* Add a procedure
(either <thunk>)
that calls thunk and returns its values wrapped into a Right except
for when <thunk> raises an exception. In that case, wrap the error
object in a Left and return it.
The "inverse" of this procedure is `either-ref'. The name "either" is
probably not the best one.
Implementation:
(define (either thunk)
(guard (c (else (left c))) (call-with-values thunk right)))
* Add maybe-let* that works like and-let* but can handle multiple
values and can accept #f values.
I would be willing to contribute an implementation in case Wolfgang
doesn't want to.