[Top][All Lists]

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

Re: function help

From: Martin Helm
Subject: Re: function help
Date: Thu, 23 Feb 2012 21:36:54 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.2) Gecko/20120215 Thunderbird/10.0.2

Am 23.02.2012 21:27, schrieb Jordi Gutiérrez Hermoso:
> That's an ugly an unnecessary Matlab-inspired hack.
No idea, I do not use Matlab. It is inspired by lisps local functions
returned by a dispatch from a closure and it is for sure no hack.

> In Octave, unlike in Matlab, you can define functions in the
> interpreter and in script files.
> So you can do something like writing this in func_init.m:
>     1;
>     function out = foo(x)
>        ## ...
>     endfunction
>     function out = bar(x)
>        ## ...
>     endfunction
> And whenever you write "func_init" both foo and bar functions will be
> defined in scope.
I consider that a hack because you execute a script instead of using a
dispatch, though I sometimes use it myself.
> Subfunctions are still hidden like in Matlab, but at least you don't
> need to be doing uglier function handle hacks to just get a few
> functions into scope.

reply via email to

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