unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
* define-inlinable bug
@ 2011-07-11  6:16 BT Templeton
  2011-07-11 15:13 ` Ludovic Courtès
  0 siblings, 1 reply; 3+ messages in thread
From: BT Templeton @ 2011-07-11  6:16 UTC (permalink / raw)
  To: bug-guile

`Define-inlinable' doesn't appear to work with mutually recursive
functions. Attempting to evaluate both of the following procedure
definitions results in a stack overflow.

(define-inlinable (foo x) (bar (- x 1)))
(define-inlinable (bar y) (if (< y 0) y (foo (- y 1))))

-- 
Inteligenta persono lernas la lingvon Esperanton rapide kaj facile.
Esperanto estas moderna, kultura lingvo por la mondo. Simpla, fleksebla,
belsona, Esperanto estas la praktika solvo de la problemo de universala
interkompreno. Lernu la interlingvon Esperanton! http://lernu.net/




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: define-inlinable bug
  2011-07-11  6:16 define-inlinable bug BT Templeton
@ 2011-07-11 15:13 ` Ludovic Courtès
  2011-07-13  8:30   ` Andy Wingo
  0 siblings, 1 reply; 3+ messages in thread
From: Ludovic Courtès @ 2011-07-11 15:13 UTC (permalink / raw)
  To: bug-guile

Hello,

BT Templeton <bpt@hcoop.net> skribis:

> `Define-inlinable' doesn't appear to work with mutually recursive
> functions. Attempting to evaluate both of the following procedure
> definitions results in a stack overflow.

Indeed, mutually recursive functions cannot be inlined with this trivial
macro.

I’m not sure there’s much we can do.  Maybe we could at least document it?

Thanks,
Ludo’.




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: define-inlinable bug
  2011-07-11 15:13 ` Ludovic Courtès
@ 2011-07-13  8:30   ` Andy Wingo
  0 siblings, 0 replies; 3+ messages in thread
From: Andy Wingo @ 2011-07-13  8:30 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: bug-guile

Hi,

On Mon 11 Jul 2011 17:13, ludo@gnu.org (Ludovic Courtès) writes:

> BT Templeton <bpt@hcoop.net> skribis:
>
>> `Define-inlinable' doesn't appear to work with mutually recursive
>> functions. Attempting to evaluate both of the following procedure
>> definitions results in a stack overflow.
>
> Indeed, mutually recursive functions cannot be inlined with this trivial
> macro.
>
> I’m not sure there’s much we can do.  Maybe we could at least document it?

You can use fluid-let-syntax.  See Dybvig's example here:

  http://www.scheme.com/csug8/syntax.html#./syntax:h1

It's nonstandard but our psyntax does have it I think.

Andy
-- 
http://wingolog.org/



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-07-13  8:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-07-11  6:16 define-inlinable bug BT Templeton
2011-07-11 15:13 ` Ludovic Courtès
2011-07-13  8:30   ` Andy Wingo

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).