Why can't you export them?
*export foo* exports every method from function foo, so it doesn't matter 
how many arguments foo has.
If *compute *does a calculation depending on m, it's very good design to 
pass m as an argument to that method.
I'm pretty sure you'll find it acceptable to carry your value around and 
pass it to different functions.
This way, a function becomes an independent unit, which doesn't relay on 
any surrounding code to magically insert m into the function ;)

Am Sonntag, 16. November 2014 21:25:26 UTC+1 schrieb Justas _:
>
> Lets say I have this kind of code. How could I access variable M in 
> compute() function? 
> function algoX(data)
>   M,N = size(data)
>   param = 20
>
>   computeSomething()
> end
>
> export
> function computeSomething()
>   a = compute()
> end
>
> function compute()
>   # Needs variable M
>   M * param
> end
>
> I do not want to nest all functions, because then I wont be able to export 
> them for testing. Also I do not want to pass variable M to 
> computeSomething() and then pass to compute(). What should I do?
>
>
>

Reply via email to