guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Is apply procedure not tail recursive?


From: Andy Wingo
Subject: Re: Is apply procedure not tail recursive?
Date: Thu, 17 Jan 2013 14:37:59 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2 (gnu/linux)

On Thu 17 Jan 2013 00:34, Akop Pogosian <address@hidden> writes:

> guile> (apply + (zeros (expt 10 5)))
> ERROR: Throw to key `vm-error' with args `(vm-run "VM: Stack overflow" ())'.

Guile passes arguments on a stack with limited size.  Here there are
three arguments: apply, +, and the list.  Apply shuffles + into the
procedure spot in preparation for the tail call), and then goes to
unroll the arguments from the list into the stack.  It hits the stack
limit and raises an error.

> guile> (apply + (zeros (expt 10 6)))
> Process scheme aborted (core dumped)

Here you have found a bug in Guile, potentially quite a bad one.

Andy
-- 
http://wingolog.org/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]