defbundle shortcut
by Sven Schreiber
Hi,
quite often in some packages we just want to quickly copy a bunch of
objects into a bundle, and the names (keys) of the objects can stay the
same. How about adding a shortcut syntax do the defbundle function which
makes that possible?
The idea is that if just the first argument (a string) is provided
(which would up to now be illegal) it would have to be a separated
string with all object labels.
Example:
bundle b1 = defbundle("A,m,someobj")
would be equivalent to:
bundle b1 = defbundle("A",A, "m",m, "someobj",someobj)
Of course the mentioned objects must exist, no change there.
Maybe other whitespace characters as separators could also be supported:
bundle b1 = defbundle("A m someobj")
thanks
sven
5 years, 3 months
short seq() form
by Sven Schreiber
Hi,
and sorry, here's another syntactic-sugar feature request. Couldn't
seq(n) be made an equivalent short form for seq(1,n)?
I know, only two keystrokes, but nice to read IMHO and in this context a
25% keystroke savings, hehe.
thanks
sven
5 years, 3 months
no folder icon in new snapshot
by Sven Schreiber
Hi,
with the Dec 9th snapshot on Windows 10 there seem to be missing icons:
I noticed it in a folder-selection dialog window which was opened when
trying to set the function-package directory to something else
temporarily. (I hope that description was clear.) The directories in the
file system are not iconized with folder icons, but with generic grey
document icons.
thanks
sven
5 years, 3 months
Packages in GUI menu and stdize() function
by Ioannis A. Venetis
Hi all,
Using gretl 2019d-git
MS Windows (x86_64)
build date 2019-12-09
(A) I cannot see any of the packages installed in my computer under the
menus. Their GUI lines have disappear.
Although the packages are still in my computer and scripting works
...
include *.gfn
(B) The stdize function does not return the same type as input if a
single series is the input
For example in
<hansl>
clear
open australia.gdt
stdize PAU PUS
list xlist = E IAU
x = stdize(xlist)
xx = stdize(IUS)
</hansl>
I do not see series xx but s_IUS
Yiannis
5 years, 3 months
Translations
by Sven Schreiber
Hi,
in preparation for the release (of 2019d) I have updated the German
translation de.po in git. Haven't tested so far, but this time I think
(I hope) the probability of breakage is quite low.
cheers
sven
5 years, 3 months
Stringified series cannot be over-written
by Artur Tarassow
Hi,
I am bit puzzled why one cannot assign new values to a stringified
series (using current git). Why should be the behavior differently
compared to numerical series?
<hansl>
set verbose off
nulldata 2
series foo = seq(1,2)'
strings s = defarray("A", "B")
stringify(foo, s)
print foo
series foo = 1 # "Cannot overwrite entire string-valued
</hansl>
Thanks,
Artur
5 years, 3 months
"foreach" loops: accept array of strings
by Allin Cottrell
This follows up on the thread started by Artur at
https://www.mail-archive.com/gretl-devel@gretlml.univpm.it/msg10198.html
Since "foreach" loops are advertised as working via string
substitution, it seems they really ought to work for arrays of
strings, and that's now in git. Trivial example follows:
<hansl>
strings S = defarray("tea", "coffee", "schnapps")
loop foreach i S -q
print "Would you like $i?"
endloop
</hansl>
It's not clear to me that it's desirable to extend this to arrays of
other types, nor what that would actually involve in terms of the
usability (or otherwise) of "$i".
Here's one possible notion:
<hansl status="notional">
matrices MM = defarray(I(3), mnormal(3,3))
loop foreach i MM -q
eval $i[1,1]
endloop
</hansl>
where we use string substitution to make "$i" come out as "MM[1]"
then "MM[2]". Personally, I don't find this at all appealing.
A second possible notion:
<hansl status="notional">
matrices MM = defarray(I(3), mnormal(3,3))
loop foreach i MM -q
eval MM[i][1,1]
endloop
</hansl>
In this case we don't mess with supporting string substitution for
arrays of matrices but just let "foreach i MM" stand as shorthand
for "i=1..nelem(MM)", thereby saving 2 keystrokes. Meh.
Allin
5 years, 3 months
foreach-loop for arrays
by Artur Tarassow
Hi all,
I am right that the foreach-loop variant only supports lists but not
string arrays or matrices? At least the following does not work using
latest git-version.
<hansl>
strings S = defarray("A", "B", "C")
loop foreach i S -q
eval S[i]
endloop
matrix M = seq(1,3)
loop foreach i M -q
eval M[i]
endloop
</hansl>
I would find this quite handy, as nelem() or rows()/cols() may be avoided.
While it's clear what to do for a vector (simply iterate over the
column-/row-dimension), one may say that iteration for a matrix may work
over rows thus returning all columns for each row.
Best,
Artur
5 years, 4 months
Delete non-existing bundle element
by Artur Tarassow
Sorry for another post,
Trying to delete a non-existing bundle element results in a "Data error"
and full stop which cannot be captured though the catch-command.
Why not printing a warning but ignoring the non-existing bundle-element?
Or at least, there should be no full-stop in case of an error when using
the catch-command, I guess.
<hansl>
bundle b = defbundle("A", 1, "C", 3)
catch delete b.A # works, as "A" exists
catch delete b.B # full stop
print "foo"
</hansl>
Current, one would have to run:
<hansl>
if inbundle(b, "B")
delete b.B
endif
</hansl>
Thanks,
Artur
5 years, 4 months