Given the fixes we've accumulated, and given that the New Year is
upon us, I'm thinking we should do a new release soon. But before
doing that I'd like to resolve a couple of points about array
functions.
Sorry, this is a bit long, but I'd appreciate hearing comments from
anyone who's able to follow what I'm talking about!
First, we have at present the semi-documented array() function (it's
in the User's Guide, but not in the Function Reference), and also
the undocumented mkarray() function, which lets you define an array
by supplying one or more expressions which evaluate to the specified
type. See
http://lists.wfu.edu/pipermail/gretl-devel/2015-November/006236.html
In relation to mkarray(), I floated the idea of merging this with
array() in
http://lists.wfu.edu/pipermail/gretl-devel/2015-December/006373.html
and Jack responded enthusiastically in
http://lists.wfu.edu/pipermail/gretl-devel/2015-December/006374.html
However, I'm now thinking that the merger is not such a good idea,
on account of the ambiguity of something like the following:
<hansl>
matrix m = {1, 3, 5}
matrices M = array(m[2])
</hansl>
Do we read this as a request to create an array with 3 empty matrix
slots, or as a request to create an array with one member, namely
the second element of m, taken as a 1 x 1 matrix?
Note that if we did not merge the two functions, then
matrices M = array(m[2])
would unambiguously select the first of these alternates, while
matrices M = mkarray(m[2])
would unambiguously select the second.
We could just legislate that one of these interpretations is
favoured, in which the user wanting the other one would have to take
an extra step:
scalar n = m[2]
matrices M = array(n)
# OR
matrix m2 = m[2]
matrices M = array(m2)
But I think it may be cleaner to retain both functions (and of
course, document both).
Second issue: at present the "print" command as applied to an array
gives fairly minimal information. For example, the input
<hansl>
strings S = mkarray("happy", "new", "year")
print S
</hansl>
produces the output
? print S
Array of strings, length 3
But we also have the undocumented function putarray(), which gives a
basic printout of the array members, as in
? putarray(S)
happy
new
year
Here, I'd like to canvas the options (a) keep what we have right now
and document putarray(), or (b) make the "print" command do what
putarray() does, and scrap putarray(). (Bear in mind that the array
in question might contain huge matrices rather than short strings.)
Let me note that both of these array-printing options are probably
best considered as relevant to writers of function packages,
primarily as debugging tools. If you really want to "pretty print"
an array you would probably want to write your own function.
Allin