On Thu, 18 Aug 2016, Artur T. wrote:
Hi all,
I would like to declare a list "z" to a bundle "b" but I am surprised
to
see that this doesn't seem to work:
<gretl>
open denmark.gdt --quiet
bundle b = null
list z = const LRM
b.z = z
</gretl>
Message: "The variable b is of type bundle, not acceptable in context"
Actually, that message is kind of backwards; it's really the list z
that is "not acceptable" in the context of adding something to a
bundle. We'll see what we can do about that.
Is this actually intended? Also, is there in alternative how to
handle
this (I disregard the possibility to define a matrix which could be send
to "b" for the moment).
Yes, it's intended. The point is that bundles are not tied to, or
synchronized with, the life-cycle and mutations of a dataset. A
bundle that was created with dataset D1 in place may be read at some
point when D1 has been extensively modifed, or replaced by a
different dataset D2, or when there's no dataset in place at all.
Since a list as such is a record of the ID numbers of a set of
series in a given dataset, it doesn't make sense (in our view) to
allow putting a list into a bundle.
As for the matrix-based alternative, note that there are two
meanings for "creating a matrix out of a list":
matrix m = {list}
creates a matrix which contains all the data referenced by list,
while
matrix m = list
creates a vector holding the ID numbers in list. You can use the
latter method to "emulate" putting a list into a bundle. Then when
you want to extract it you can say
[catch] list L = b.m
to turn it back into a list. The virtue of this approach is that it
will automatically flag an error if m cannot be converted to a
list given the current dataset (or absence of one) -- that is, if
it contains any elements that are out-of-bounds if considered as
ID numbers of series.
It's implicit in the User's Guide that lists can't go into bundles
(lists are not mentioned as a valid content type) but it would be a
good idea to make this explicit, and present the matrix-based
"workaround" for those who really want to bundle lists.
Allin