On Fri, 28 Apr 2017, Allin Cottrell wrote:
Since we already have defarray() and deflist() -- the latter in
fairly recent
git; see
http://lists.wfu.edu/pipermail/gretl-devel/2017-April/007580.html
it seemed like time to have a defbundle() function. It's now in git, and
documented in the online Function Reference. Saves you having to declare a
bundle as "null" then add one member at a time. Example:
bundle b = defbundle("x", 5, "mat", I(3), "str", "Some
string")
The (zero or more) arguments have to come in pairs of (string) key followed
by an expression that evaluates to an object of a type that can be included
in a bundle. Type coercion is not supported; if you want to do that you have
to use the traditional method of adding an object to a (pre-declared) bundle,
as in
series b.s5 = 5
Aaaah, this is very nice, thanks Allin!
This could come in particularly handy if you combine it with the "+"
operator. Example:
<hansl>
a = defbundle("uno", 1, "due", seq(4,7))
b = defbundle("tre", "ha", "quattro", 0)
print a b c
</hansl>
-------------------------------------------------------
Riccardo (Jack) Lucchetti
Dipartimento di Scienze Economiche e Sociali (DiSES)
Università Politecnica delle Marche
(formerly known as Università di Ancona)
r.lucchetti(a)univpm.it
http://www2.econ.univpm.it/servizi/hpp/lucchetti
-------------------------------------------------------