message() function proposal
by Riccardo (Jack) Lucchetti
Dear all,
during a recent exchange that I had with Oleh Komashko, the idea came up
thet it'd be quite nice to have a short-hand function for printing out
messages in scripts, in a standardised and recognisable form. So I wrote a
little prototype in hansl, that you see below:
<hansl>
set verbose off
function void message(string m, scalar l[60])
d = "-"
lm = strlen(m)
scalar k = lm + 8 > l ? l - 8 : lm
s = ""
if lm == 0
loop i=1..l --quiet
s = s ~ d
endloop
else
loop i=1..3 --quiet
s = s ~ d
endloop
s = s ~ " " ~ m[1:k] ~ " "
loop i=k+6..l --quiet
s = s ~ d
endloop
endif
printf "%s\n", s
end function
message("Ha")
message("")
message("A shorter one", 40)
message("An inordinately long one, which should be truncated, really")
</hansl>
My question is: would it be a good idea to turn this into a native
function?
-------------------------------------------------------
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
-------------------------------------------------------
7 years, 2 months
next release
by Allin Cottrell
Sorry, we've timed out for a 2018a release this week (I'm about to
head off for the weekend). Hopefully we should be able to get a
release out on Monday.
Allin
7 years, 2 months
de.po update
by Sven Schreiber
Hi,
I'm attaching the German translation update de.po. I don't have a
read-write git checkout here right now, sorry, so could someone commit
this for me? Thanks.
And a question: Is "Working directory tooltip" really a translatable
string meant for the user, including the literal "tooltip"?
Finally, if we could wait with the release for a few days such that the
updated translations can be briefly tested (also on the Windows
snapshots) that would be nice.
thanks,
sven
7 years, 2 months
packages: no-dataset-ok but still error about no dataset?
by Sven Schreiber
Hi,
I'm a bit confused about the situation with the package FEP (current
version). We specified no-dataset-ok and the info window of the package
(1.3) says "Data requirement: none". However, when I "execute" the
package from the listing window I get an error window "Please open data
file first".
This does not happen with other packages that don't need a dataset.
However, FEP specifies a GUI main function, and the other packages don't
seem to do that (e.g. extra.gfn, corresp.gfn), so maybe that's the
difference?
thanks,
sven
7 years, 2 months
default for lrvar()
by Sven Schreiber
Hi,
the doc for lrvar() says that a certain default is used when the second
param is set to a negative value. Why not make the second param optional
then (and treat it as -1 when it's omitted)?
thanks,
sven
7 years, 2 months
extracting row names of a matrix
by oleg_komashko@ukr.net
Dear all,
#<hansl
function string get_rnames(matrix M)
string s = sprintf("%d",M)
nss = nlines(s)
string line
scalar i = 1
strings S = array(nss)
loop while getline(s, line) -q
S[i]= sprintf("%s", line)
i++
endloop
ret = ""
if nelem(strsplit(S[1])) == 2
loop i = 1..nss -q
ret = ret~" "~strsplit(S[i])[1]
endloop
ret = strstrip(ret)
endif
return ret
end function
# example
M = I(2)
M[1,1] = NA
rownames(M, "a b")
eval get_rnames(M)
#hansl>
output:
? eval get_rnames(M)
a b
Is there a less roundabout way to extract row names
of a matrix
Oleh
7 years, 2 months
gretl 2018a?
by Allin Cottrell
I think we've now accumulated enough bug fixes and refinements to
make it worth hoisting 2017e out of limbo as release 2018a.
http://gretl.sourceforge.net/ChangeLog.html
Are there any issues that people would really like to see addressed
before we do that?
Allin
7 years, 2 months
Links to function package documentation on the web
by Sven Schreiber
Hi,
some colleagues have suggested that it would be useful if the help
(plain text or pdf) of the many contributed function packages were also
available on the web. That way it would also be found by search engines.
I think the most natural place would be to extend the list page
(http://ricardo.ecn.wfu.edu/gretl/cgi-bin/gretldata.cgi?opt=SHOW_FUNCS)
with links to the underlying help texts. Probably just add another
column "Documentation" at the end, after the one with the short
descriptions. And in that new column there would only be a single link
for each entry.
Allin, is the code to produce that web page part of the git source? (I
couldn't find it straight away.) If not, could you send it and I could
try to extend it.
thanks,
sven
7 years, 2 months
matrix elementwise truth
by Sven Schreiber
Hi,
the following examples give different results (different shapes)
depending on whether '<' or '.<' is used. Not sure whether this is
expected or a bug.
<hansl>
eval I(3) < 1
eval I(3) .< 1
eval ones(3,1) < 1
eval ones(3,1) .< 1
</hansl>
thanks,
sven
7 years, 2 months