Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Returning a rowvector on-the-fly in Mata, as in -return(el1, el2, ...)-


From   Joseph Coveney <[email protected]>
To   Statalist <[email protected]>
Subject   st: Returning a rowvector on-the-fly in Mata, as in -return(el1, el2, ...)-
Date   Sun, 14 May 2006 18:31:13 +0900

Is is bad Mata programming practice to assemble a returned vector (or
matrix) inside the -return()- statement?

Stata won't let you -return matrix A = (element1, element2, . . .)-.  In
Mata, on the other hand, it seems that you can do the analogous operation.
But that doesn't imply that you ought to.

Is it too-clever-for-your-own-good to, for example,

   -return(element1, element2, . . .)-

    or even

   -return( (element1, element2, . . .) )-

for a function that returns a row vector?  (The elements are expressions,
i.e., literals, scalar variables, return functions, of the proper datatype.)

Joseph Coveney

*
*   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/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index