fxmapping-unfold(-maybe) Marc Nieper-Wißkirchen (11 Jun 2021 18:15 UTC)
Re: fxmapping-unfold(-maybe) Wolfgang Corcoran-Mathe (11 Jun 2021 20:15 UTC)
Re: fxmapping-unfold(-maybe) Marc Nieper-Wißkirchen (11 Jun 2021 22:27 UTC)
Re: fxmapping-unfold(-maybe) Wolfgang Corcoran-Mathe (12 Jun 2021 16:44 UTC)
Re: fxmapping-unfold(-maybe) Marc Nieper-Wißkirchen (12 Jun 2021 19:58 UTC)
Re: fxmapping-unfold(-maybe) Wolfgang Corcoran-Mathe (12 Jun 2021 19:15 UTC)
Re: fxmapping-unfold(-maybe) Marc Nieper-Wißkirchen (12 Jun 2021 20:07 UTC)
Re: fxmapping-unfold(-maybe) Wolfgang Corcoran-Mathe (12 Jun 2021 22:18 UTC)
Re: fxmapping-unfold(-maybe) Wolfgang Corcoran-Mathe (12 Jun 2021 22:20 UTC)
Re: fxmapping-unfold(-maybe) Marc Nieper-Wißkirchen (13 Jun 2021 08:36 UTC)
Re: fxmapping-unfold(-maybe) Wolfgang Corcoran-Mathe (13 Jun 2021 19:19 UTC)
Re: fxmapping-unfold(-maybe) Marc Nieper-Wißkirchen (13 Jun 2021 19:39 UTC)
Re: fxmapping-unfold(-maybe) Wolfgang Corcoran-Mathe (14 Jun 2021 00:18 UTC)
(missing)
Re: fxmapping-unfold(-maybe) Wolfgang Corcoran-Mathe (14 Jun 2021 14:53 UTC)
Re: fxmapping-unfold(-maybe) Wolfgang Corcoran-Mathe (14 Jun 2021 14:59 UTC)
Re: fxmapping-unfold(-maybe) Marc Nieper-Wißkirchen (14 Jun 2021 15:15 UTC)
Re: fxmapping-unfold(-maybe) Marc Nieper-Wißkirchen (14 Jun 2021 15:42 UTC)
Re: fxmapping-unfold(-maybe) Wolfgang Corcoran-Mathe (14 Jun 2021 15:44 UTC)
Re: fxmapping-unfold(-maybe) Marc Nieper-Wißkirchen (14 Jun 2021 15:41 UTC)
Re: fxmapping-unfold(-maybe) Wolfgang Corcoran-Mathe (14 Jun 2021 16:10 UTC)
Re: fxmapping-unfold(-maybe) Marc Nieper-Wißkirchen (14 Jun 2021 16:28 UTC)
Re: fxmapping-unfold(-maybe) Marc Nieper-Wißkirchen (14 Jun 2021 17:12 UTC)
Re: fxmapping-unfold(-maybe) Wolfgang Corcoran-Mathe (14 Jun 2021 18:27 UTC)
Re: fxmapping-unfold(-maybe) Marc Nieper-Wißkirchen (14 Jun 2021 18:43 UTC)
Re: fxmapping-unfold(-maybe) Wolfgang Corcoran-Mathe (14 Jun 2021 05:50 UTC)
Re: fxmapping-unfold(-maybe) Marc Nieper-Wißkirchen (14 Jun 2021 07:40 UTC)
Re: fxmapping-unfold(-maybe) John Cowan (12 Jun 2021 23:54 UTC)
Re: fxmapping-unfold(-maybe) Marc Nieper-Wißkirchen (13 Jun 2021 14:13 UTC)
Re: fxmapping-unfold(-maybe) Shiro Kawai (15 Jun 2021 04:18 UTC)
Re: fxmapping-unfold(-maybe) Marc Nieper-Wißkirchen (15 Jun 2021 06:16 UTC)
Re: fxmapping-unfold(-maybe) Shiro Kawai (15 Jun 2021 09:44 UTC)
Re: fxmapping-unfold(-maybe) Marc Nieper-Wißkirchen (15 Jun 2021 10:37 UTC)
Re: fxmapping-unfold(-maybe) Shiro Kawai (15 Jun 2021 14:20 UTC)
Re: fxmapping-unfold(-maybe) Marc Nieper-Wißkirchen (15 Jun 2021 14:33 UTC)
Re: fxmapping-unfold(-maybe) John Cowan (15 Jun 2021 23:08 UTC)
Re: fxmapping-unfold(-maybe) Marc Nieper-Wißkirchen (16 Jun 2021 06:48 UTC)
Re: fxmapping-unfold(-maybe) John Cowan (18 Jun 2021 03:01 UTC)
Re: fxmapping-unfold(-maybe) Marc Nieper-Wißkirchen (18 Jun 2021 06:26 UTC)
Re: fxmapping-unfold(-maybe) Ray Dillinger (20 Jun 2021 04:08 UTC)
Re: fxmapping-unfold(-maybe) Shiro Kawai (20 Jun 2021 04:28 UTC)
Re: fxmapping-unfold(-maybe) Marc Nieper-Wißkirchen (20 Jun 2021 08:00 UTC)
Re: fxmapping-unfold(-maybe) Wolfgang Corcoran-Mathe (20 Jun 2021 16:17 UTC)
Re: fxmapping-unfold(-maybe) Marc Nieper-Wißkirchen (20 Jun 2021 16:19 UTC)
Re: fxmapping-unfold(-maybe) Arthur A. Gleckler (20 Jun 2021 16:25 UTC)
Re: fxmapping-unfold(-maybe) Shiro Kawai (17 Jun 2021 17:32 UTC)
Re: fxmapping-unfold(-maybe) Marc Nieper-Wißkirchen (17 Jun 2021 18:00 UTC)
Re: fxmapping-unfold(-maybe) Shiro Kawai (17 Jun 2021 21:25 UTC)
Re: fxmapping-unfold(-maybe) Marc Nieper-Wißkirchen (18 Jun 2021 06:09 UTC)
Re: fxmapping-unfold(-maybe) Shiro Kawai (19 Jun 2021 22:05 UTC)
Re: fxmapping-unfold(-maybe) Marc Nieper-Wißkirchen (20 Jun 2021 07:00 UTC)
Re: fxmapping-unfold(-maybe) Shiro Kawai (20 Jun 2021 07:36 UTC)
Re: fxmapping-unfold(-maybe) Marc Nieper-Wißkirchen (20 Jun 2021 08:31 UTC)
Re: fxmapping-unfold(-maybe) Marc Nieper-Wißkirchen (20 Jun 2021 09:10 UTC)
Re: fxmapping-unfold(-maybe) Marc Nieper-Wißkirchen (20 Jun 2021 10:44 UTC)
Re: fxmapping-unfold(-maybe) Shiro Kawai (20 Jun 2021 21:39 UTC)
Re: fxmapping-unfold(-maybe) Marc Nieper-Wißkirchen (21 Jun 2021 06:09 UTC)
Re: fxmapping-unfold(-maybe) Wolfgang Corcoran-Mathe (17 Jun 2021 18:01 UTC)
Re: fxmapping-unfold(-maybe) John Cowan (12 Jun 2021 04:06 UTC)

Re: fxmapping-unfold(-maybe) Wolfgang Corcoran-Mathe 14 Jun 2021 15:44 UTC

On 2021-06-14 17:15 +0200, Marc Nieper-Wißkirchen wrote:
> Am Mo., 14. Juni 2021 um 16:59 Uhr schrieb Wolfgang Corcoran-Mathe <
> xxxxxx@sigwinch.xyz>:
>
> > On 2021-06-14 10:53 -0400, Wolfgang Corcoran-Mathe wrote:
> > > On 2021-06-14 10:23 +0200, Marc Nieper-Wißkirchen wrote:
> > > > To remedy the problem with fxmapping-unfold*, change the semantics of
> > STOP.
> > > > It shall abandon the current continuation and pass the resulting
> > fxmapping
> > > > to the continuation of the call to fxmapping-unfold*. Make
> > INSERT&CONTINUE
> > > > implicit by returning to the continuation of the call to the callback.
> >
> > I just noticed that this is also afflicted by the "tail-loop or die"
> > problem.  The only way to implement these semantics that I can see is
> > to unfold iteratively (sometimes called a "tabulate"), which is
> > usually unidiomatic.
>
> Could you explain to me what you mean by both statements here? It sounds
> very interesting.

As an example, here's the required-tail-call/list version of the
variant unfold:

    (define (accumulate f seed)
      (f (lambda () '())                  ; stop
         (lambda (x seed*)                ; insert & continue
           (cons x (accumulate f seed*)))
         seed))

If we want to rewrite this so that the `stop' procedure returns the
accumulated list, we'd of course have to rewrite this as a tail-loop,
as in your earlier email.

This is not such an enormous difficulty, but it is generally more
convoluted to construct inductively-defined structures iteratively.
In the list example, it's simply a matter of reversing the result, but
constructing trees this way, e.g., can be a pain.  It's natural to
construct inductively-defined structures recursively; as Olin's
comment to SRFI 1 says, "Don't stand on your head to iterate!".

In some cases, recursive implementations might also be more
efficient.  Building a radix tree (see the SRFI 224 sample
implementation) recursively accumulates call frames, of course, but
building one tail-recursively accumulates thunks.  Depending on the
Scheme implementation, the latter may be (and often are) more
expensive.

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

"I think, to most people, scripting is a lot like obscenity.  I can't
define it, but I'll know it when I see it." --Larry Wall