help-octave
[Top][All Lists]
Advanced

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

Re: 0.74: recursive function calls not supported yet


From: John Eaton
Subject: Re: 0.74: recursive function calls not supported yet
Date: Wed, 21 Jul 93 18:29:05 EDT

On Wed, 21 Jul 93 15:46:34 +0100, address@hidden wrote:

: I encountered this unexpected behaviour:
: 
: >Octave, version 0.74.  Copyright (C) 1992, 1993, John W. Eaton.
: >This is free software with ABSOLUTELY NO WARRANTY.
: >For details, type `warranty'.
: 
: >octave:1> hadamard(3)
: >error: recursive function calls not supported yet
: 
: Recursion definitely worked in previous releases. I tried both, a
: decstation 3100 (ultrix) and a NeXT (NS 3.0). Can anybody 
: confirm/disconfirm this?

Actually, if it worked, you were just getting lucky.  For example, one
of these would work, but the other would fail:

  function y = fact (n)
    if (n > 1) y = fact (n - 1) * n; else y = 1; endif
  end

  function y = fact (n)
    if (n > 1) y = n * fact (n - 1); else y = 1; endif
  end

To fix this, some work needs to be done in the symbol table code and
the code that implements function calls to properly create a new
context for recursive calls.

jwe


reply via email to

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