SRFI 235 review Wolfgang Corcoran-Mathe (03 Sep 2022 13:51 UTC)
Re: SRFI 235 review Marc Nieper-Wißkirchen (03 Sep 2022 16:45 UTC)
Re: SRFI 235 review John Cowan (03 Sep 2022 17:21 UTC)
Re: SRFI 235 review Marc Nieper-Wißkirchen (03 Sep 2022 18:18 UTC)
Re: SRFI 235 review Wolfgang Corcoran-Mathe (04 Sep 2022 20:06 UTC)
Re: SRFI 235 review Marc Nieper-Wißkirchen (05 Sep 2022 06:31 UTC)
Re: SRFI 235 review John Cowan (05 Sep 2022 16:44 UTC)
Re: SRFI 235 review Marc Nieper-Wißkirchen (05 Sep 2022 17:58 UTC)
Re: SRFI 235 review John Cowan (05 Sep 2022 23:45 UTC)
Re: SRFI 235 review Marc Nieper-Wißkirchen (06 Sep 2022 06:27 UTC)
Re: SRFI 235 review Wolfgang Corcoran-Mathe (06 Sep 2022 19:46 UTC)
Re: SRFI 235 review Marc Nieper-Wißkirchen (06 Sep 2022 21:39 UTC)
Re: SRFI 235 review John Cowan (07 Sep 2022 01:46 UTC)
Re: SRFI 235 review Per Bothner (07 Sep 2022 05:04 UTC)
Re: SRFI 235 review John Cowan (07 Sep 2022 18:37 UTC)
Re: SRFI 235 review Per Bothner (07 Sep 2022 22:23 UTC)
Re: SRFI 235 review John Cowan (07 Sep 2022 23:29 UTC)
Re: SRFI 235 review Marc Nieper-Wißkirchen (09 Sep 2022 09:25 UTC)
Re: SRFI 235 review John Cowan (09 Sep 2022 19:54 UTC)
Re: SRFI 235 review Marc Nieper-Wißkirchen (09 Sep 2022 20:11 UTC)
Re: SRFI 235 review Marc Nieper-Wißkirchen (07 Sep 2022 06:29 UTC)
Re: SRFI 235 review Wolfgang Corcoran-Mathe (07 Sep 2022 18:02 UTC)
Re: SRFI 235 review Marc Nieper-Wißkirchen (07 Sep 2022 20:10 UTC)
Re: SRFI 235 review Lassi Kortela (07 Sep 2022 18:41 UTC)
Re: SRFI 235 review John Cowan (03 Sep 2022 17:17 UTC)
Re: SRFI 235 review Arvydas Silanskas (04 Sep 2022 08:35 UTC)

Re: SRFI 235 review Wolfgang Corcoran-Mathe 04 Sep 2022 20:06 UTC

Hi Marc, and thanks for your responses.

On 2022-09-03 20:18 +0200, Marc Nieper-Wißkirchen wrote:
> > That's all right, as long as you test 'promise?' before 'procedure?', thus:
> >
> > (cond ((promise? thunk)
> >            (force thunk))
> >           ((procedure? thunk)
> >            (thunk))
> >           (t (error "not a thunk")))
> >
> > or more simply:
> >
> > ((promise? thunk) (force thunk) (thunk))
>
> That would work if all procedures returned by "lambda" and by all
> other procedure constructors but "force" and "make-promise" and using
> only the standard exports of R7RS to construct them are guaranteed to
> be disjoint from possible values on which "promise?" returns true. I
> may be wrong but I currently don't see where R7RS makes this
> guarantee.

Is there any serious danger of unexpected behavior resulting from the
above code, though?  If an implementation’s ‘promise?’ is true of
(some) thunks, then I’d expect (force thunk) to evaluate to (thunk).
If it instead returned ‘thunk’, say, then it would be a problem for
us, but it would also be a poor implementation.  Thus I don’t see any
practical objections to this kind of dispatch.

You might argue that the promise version of ‘if-procedure’, etc.
belong in a different library, perhaps a library of useful
delayed-evaluation forms.  Maybe so.  To me, they seem similar
enough to the thunk versions to warrant unifying them.

--
Wolfgang Corcoran-Mathe  <xxxxxx@sigwinch.xyz>