On Sat, 9 Feb 2008, Riccardo (Jack) Lucchetti wrote:
On Sat, 9 Feb 2008, Sven Schreiber wrote:
> That's a nice change, thanks. On a related issue, AFAIK matrix assignments
> always have to start with 'matrix' as well, or is this no longer true?
It hasn't been true for a while. The "matrix", "scalar" and
"series"
statements are just aliases for "genr"; as such, they can be omitted. However,
they may be useful to handle potentially ambiguous cases. For example
genr scx = 0 # generates the scalar 0
scalar scx = 0 # same as above
series sex = 0 # generates a series full of 0s
# (no pun intended on anyone's private life)
matrix mx = 0 # generates a 1x1 zero matrix
Jack is quite right. I'll expand just a little. In most cases
genr x = <expression>
<type> x = <expression>
x = <expression>
are all equivalent, for <type> = {"scalar", "series",
"matrix"}.
if the variable "x" is being created anew, writing its type
explicitly is, IMO, a good idea; and (as Jack says) this is
required if you want x to be of a type other than the default or
"natural" type that would result from a given <expression> -- for
example, scalar for <expression> = "0".
If x is already defined, the type specification should be
redundant; it ought to be picked up by gretl. Please submit a bug
report if this doesn't happen correctly.
That leaves the types "list" and "string". We're working on
"list"; it's still somewhat special but becoming less so. As for
"string", it's currently handled outside of the "genr" apparatus,
so it's still the case that the "string" type-specifier is needed
in all string-variable operations that might be confused with
genr commands.
Allin.