assume-just Marc Nieper-Wißkirchen (16 Jun 2020 20:29 UTC)
Re: assume-just John Cowan (17 Jun 2020 02:39 UTC)
Re: assume-just Marc Nieper-Wißkirchen (17 Jun 2020 07:27 UTC)
Re: assume-just Shiro Kawai (17 Jun 2020 07:33 UTC)
Re: assume-just Marc Nieper-Wißkirchen (17 Jun 2020 08:00 UTC)
Re: assume-just Shiro Kawai (17 Jun 2020 08:15 UTC)
Re: assume-just Marc Nieper-Wißkirchen (17 Jun 2020 09:50 UTC)
Re: assume-just Arthur A. Gleckler (17 Jun 2020 17:17 UTC)
Re: assume-just Marc Nieper-Wißkirchen (17 Jun 2020 17:23 UTC)
Re: assume-just Arthur A. Gleckler (17 Jun 2020 17:52 UTC)
Re: assume-just Marc Nieper-Wißkirchen (17 Jun 2020 18:27 UTC)

assume-just Marc Nieper-Wißkirchen 16 Jun 2020 20:28 UTC

The (assume OBJ MESSAGE ...) form of SRFI 145 returns OBJ if OBJ is
not #f. Otherwise, the behavior is undefined (in other words an error
in debug or non-optimized modes).

So this uses the "truth" protocol in the language of SRFI 189. The
disadvantage, when compared to SRFI 189's "maybe" protocol, is,
obviously, that #f cannot be a regular value in this protocol.

So I am wondering whether

(assume-just MAYBE-EXPR MESSAGE ...)

is helpful when programming intensively with Maybes.

It would be equivalent to

(maybe-ref MAYBE-EXPR (lambda () (assume #f MESSAGE ...)))

So when you know that some expression X has to be a Just, you would
use (assume-just X) to get at the payload, helping optimizing
compilers.