help-octave
[Top][All Lists]
Advanced

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

Re: explanation what "error: can't redefine read-only symbol foo" means


From: David Bateman
Subject: Re: explanation what "error: can't redefine read-only symbol foo" means in detail
Date: Tue, 06 Mar 2007 14:19:23 +0100
User-agent: Thunderbird 1.5.0.7 (X11/20060921)

Andreas Romeyke wrote:
> Hi,
>
> I did not found a long description what the error message "error:
> can't redefine read-only symbol foo" means in detail.
>
> Please could anyone tell me an example which generates the error
> above? It seems to me that the function where Octave reports this
> error is similar to:
>
> function [bar] = foo(baz)
>     [..]
>     if (..)
>        bar2=foo(baz2)
>     end
>
> But recursive calls should be allowed or I am wrong? I read the
> documentation but I did not found a detailled explanation about
> recursion or the error message above.
>
> Please could you tell me?
>
> Bye Andreas
>
Running

function baz = foo (bar)
  if (bar)
    baz = bar + foo (--bar);
  else
    baz = 0;
  endif
endfunction

in 2.9.9+ I get

octave:1> foo(5)
ans =  15

So I don't see what the problem is. Can you give a full example...

D.




reply via email to

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