[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: nested functions?
From: |
Vic Norton |
Subject: |
Re: nested functions? |
Date: |
Thu, 20 Feb 2014 07:59:40 -0500 |
On Feb 19, 2014, at 12:11 PM, c. <address@hidden> wrote:
>
> On 19 Feb 2014, at 17:45, fork <address@hidden> wrote:
>
>> Vic Norton <vic <at> norton.name> writes:
>>
>>> I would like to be able load a bunch of functions with a
>>> a command like "XXfunctions".
>
> We already have such command, it's called "pkg", so why not put
> your functions into a package so you can just do
>
> pkg load XXfunctions
>
> and
>
> pkg unload XXfunctions
>
> ?
> c.
I don't use any packages, Carlo, but that may be just what I need. What would
be a nice, simple package to emulate?
In so far as nested functions I see that my test function
function outerfunc()
global printhello = 1;
nested1();
function nested1()
global printhello;
if printhello
printf("hello world\n");
else
printf("goodbye world\n");
endif
endfunction
endfunction
does works with Octave 3.6.4, albeit with a warning:
octave> outerfunc
warning: nested functions are coerced into subfunctions in file
/Users/vic/Norton/Programming/octave/m/tests/outerfunc.m
hello world
octave> global printhello
octave> printhello = 0;
octave> outerfunc
goodbye world
octave>
That is encouraging!
Regards,
Vic
- nested functions?, Vic Norton, 2014/02/18
- Re: nested functions?, Mike Miller, 2014/02/18
- Re: nested functions?, Vic Norton, 2014/02/18
- Re: nested functions?, Mike Miller, 2014/02/18
- Re: nested functions?, Benjamin Abbott, 2014/02/18
- Re: nested functions?, Mike Miller, 2014/02/18
- Re: nested functions?, Vic Norton, 2014/02/18
- Re: nested functions?, fork, 2014/02/19
- Re: nested functions?, c., 2014/02/19
- Re: nested functions?,
Vic Norton <=
- Re: nested functions?, c., 2014/02/20
- Unmaintained packages on Octave-Forge, Jordi GutiƩrrez Hermoso, 2014/02/20
- Re: Unmaintained packages on Octave-Forge, c., 2014/02/20
- writing packages (Re: nested functions?), Vic Norton, 2014/02/20