unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Andy Wingo <wingo@pobox.com>
To: Thien-Thi Nguyen <ttn@gnuvola.org>
Cc: guile-devel@gnu.org
Subject: Re: rfc: (ice-9 accumulate)
Date: Sat, 09 Jan 2010 22:55:58 +0100	[thread overview]
Message-ID: <m3skafq6xd.fsf@pobox.com> (raw)
In-Reply-To: <873a2fo8wc.fsf@ambire.localdomain> (Thien-Thi Nguyen's message of "Sat, 09 Jan 2010 11:44:03 +0100")

Greets,

On Sat 09 Jan 2010 11:44, Thien-Thi Nguyen <ttn@gnuvola.org> writes:

> Would there be any interest in adding (ice-9 accumulate) to Guile?
>
> -
> http://www.gnuvola.org/software/guile/doc/Efficient-Accumulation.html

Speaking only for myself, I would be unlikely to use it; but OTOH I am
not against having it.

> I can see several arguments against doing so:

You are not selling your idea very well here. But I'm still OK with it :)

> - The interface is procedural, possibly defeating compiler optimization.
>   When i wrote it, it was an exercise for hobbit.  The hope was that
>   hobbit could eventually learn to optimize usage of (ice-9 accumulate)
>   calls to (strength-, complexity-)reduce them to (ice-9 q) calls, where
>   other data-oriented optimizations can come into play.  Perhaps that
>   hope was only a non-compiler-geek dream (sounds nice but unfeasible).
>   Perhaps Andy can either revive this hope or kindly kill it off now?

So, here's the deal, as far as I understand inlining... (And your
question is about inlining, afaics, in the sense that the Waddell paper
treats inlining)

(1) Inlining across module boundaries: personally I have no intention of
hacking on this, beyond approaches like define-integrable (see the end
of http://www.scheme.com/tspl3/syntax.html).

The fundamental issue is that our modules are first-class rather than
syntactic. Define-integrable allows you to make a step towards the
syntactic, a very useful step.

(2) Inlining of procedures defined within one file/module: We will
probably do this, probably by treating private bindings from a module as
being letrec-bound within the module.

(3) Inlining of let or letrec-bound procedures: We will do this at some
point, and do it fairly well.

But, in this case, we still wouldn't be able to inline very well,
because it's an side-effecting interface. Once you have side effects, it
gets hard to reason about, especially in the presence of
continuations -- and you usually don't know when a continuation may be
captured.

So this particular construct is unlikely to be inlined nicely. However,
it's useful to you, and might be useful to someone else.

> - There is already something in Guile.  [If so, where?  Thanks.]

There's lots of stuff in ice-9 that noone knows about, but I don't think
there's something like this. Hopefully we can document more of it using
the new (texinfo reflection) infrastructure.

> Of course, the primary argument *for* adding it would be to make porting
> my stuff to Guile easier.  That's a selfish argument, so take it FWIW.

Well, we'd like your energy as well, so selfishness on all sides...

Cheers,

Andy
-- 
http://wingolog.org/




  reply	other threads:[~2010-01-09 21:55 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-09 10:44 rfc: (ice-9 accumulate) Thien-Thi Nguyen
2010-01-09 21:55 ` Andy Wingo [this message]
2010-01-11  6:05   ` Thien-Thi Nguyen
2010-01-11 13:21     ` Ludovic Courtès
2010-01-11 14:16       ` Thien-Thi Nguyen
2010-01-11 20:57       ` Andy Wingo
2010-01-11  0:48 ` Ludovic Courtès
2010-01-11  5:51   ` Thien-Thi Nguyen
2010-01-11 13:26     ` Ludovic Courtès
2010-01-11 14:34       ` Thien-Thi Nguyen
2010-01-11 20:51       ` Andy Wingo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m3skafq6xd.fsf@pobox.com \
    --to=wingo@pobox.com \
    --cc=guile-devel@gnu.org \
    --cc=ttn@gnuvola.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).