[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Nested Functions alternative?
From: |
Jason Carver |
Subject: |
Nested Functions alternative? |
Date: |
Sun, 21 Jun 2009 16:18:18 -0400 |
Since Octave doesn't support nested functions, is there a suggested alternative for closures of non-trivial method size?
For example, I want to do something like this:
function f = sophisticated_func_many_args(arg2,arg3,arg4)
function ans = sophisticated_func_one_arg(arg1)
#do something with args 1-4 for several lines
#set answer
end
f = @sophisticated_func_one_arg
end
>
result = built_in_library_call(one_arg_func)
This situation is particularly relevant when a library requires a single-argument function passed in (eg~ ode45). Maybe I'm just spoiled with python lately, but I don't even see the imperative workaround for this anymore. What is the suggested alternative for this pattern in Octave?
Cheers,
Carver
Slique.com - builds group memory by putting all your group's email, files and documents in one place
I'm trying this out:
http://five.sentenc.es/ (sans code, of course)
- Nested Functions alternative?,
Jason Carver <=