There is another issue with passing functions.
Suppose, the following code
function me1(string scalar he)
{
...
if (he=="he1") y = me2(x, &he1())
else if (he=="he2") y = me2(x, &he2())
else if (he=="he3") y = me2(x, &he3())
...
return(...)
}
where
function me2(x, he)
{
...
y = (*he)(x)
...
return(...)
}
Is it possible to change -me1()- such that
the different -he-'s do not have to be typed out
explicitly?
If Mata had macro expansion, I would type
function me1(string scalar he)
{
...
y = me2(x, &`he'())
...
return(...)
}
However, such things don't work in Mata. Does anyone
know a solution to this problem?
ben
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/