Dear all,
When one outputs a variable, there is no 'type' printed - is there a (native) function to query the type? Yes, e.g numberp(), for numbers, but in general?
E.g. I query gnuplot_command, then I set it to the same value:
(%i1) gnuplot_command;
(%o1) gnuplot
(%i2) gnuplot_command:gnuplot;
(%o2) gnuplot
(%i3) plot2d(x,[x,1,2]);
Maxima encountered a Lisp error:
The value
$GNUPLOT
is not of type
(OR STRING PATHNAME SYNONYM-STREAM FILE-STREAM)
when binding PATHNAME
Automatically continuing.
To enable the Lisp debugger set *debugger-hook* to nil.
That did not work, the variable is now of type symbol, not longer a string. But if I output the variable, I get not idea, if it is a string or symbol. It must be set enclosed in quotation marks, then it works.
(%i4) gnuplot_command:"gnuplot";
(%o4) gnuplot
(%i5) plot2d(x,[x,1,2]); /* works ok */
Is there any (native) function or output (typeof() or something else?) where one can get an idea, whats wrong?
Because the OUTPUT of gnuplot_command is the same in both cases. (Maybe it should be "gnuplot" in the string case)?
I found :lisp (type-of $a) but there is no Maxima equivalent?
Best regards, Wolfgang
The error you're getting is not about the variable
gnuplot, but about the value ofgnuplot_command. Neither Maxima nor Lisp supports the notion of a variable type.The bug here is that Maxima is giving an obscure internal Lisp error, rather than a meaningful Maxima error. Since it is a Lisp error, it doesn't look at
stringdispwhen displaying the value.A reasonable Maxima error message would be something like: "gnuplot_command is 'gnuplot', which is not a valid pathname string" or something.
Couple of things here. (1)
plot2d/plot3dshould try harder to get a string -- probably just call$string(viamfuncallsince it's a Maxima defmspec) from the value ofgnuplot_command.(2)
plot2d/plot3dshould, of course, catch any Lisp errors and create a Maxima error instead.I disagree that we should call $string on its arguments.
At most, accept either a string or a symbol.
Behavior like this helps no one (and should be fixed in
load, too):Tested in
Maxima on Android 3.2.1 September 7, 2018
Maxima 5.41.0 http://maxima.sourceforge.net
using Lisp ECL 16.1.3
5.41 is really old, isn't it? With current(ish) HEAD, I get:
(%i8) load(a*b); load: argument must be a string, symbol, or pathname; found: a b -- an error. To debug this try: debugmode(true);Hmm. How do you get a Lisp pathname in Maxima? Curiously
$loaddoes actually check if the arg ispathnamep.Agreed that 5.41 is carbon dated (from 2018!), but it's the latest version of Maxima On Android as far as I can tell.
Does anyone know how to build Maxima on Android with a more recent version?
On 17/06/25 07:22, Stavros Macrakis wrote:
More precisely, the release date of 5.41.0 was 2017-10-03.
Jaime
I was misled by the startup banner, which reads
I guess September 7, 2018 is the build date of MaximaOnAndroid.
Which brings up back to the original question: does anyone know how to build MoA from Maxima source?
I don't know how to build it, but this appears to be the repo for it: https://github.com/YasuakiHonda/Maxima-on-Android-AS
I would certainly like an update as well. Even though I rarely use it, it comes in very handy sometimes!
Having
stringdispset to true makes the output fromgnuplot_commandclearer that a string is expected.We could also change the definition of
$gnuplot_commandfrom adefvarto adefmvarand use the:setting-predicateoption to make sure it only accepts a string.If we do this, we should also do the same for other user-visible variables like
$mgnuplot_command,$geomview_command,$xmaxima_plot_commandat the very least. I see there are other user-variables that should probably be a string.Unless there are objections, I'm going to make
$gnuploat_commandand related variables only accept strings. Everything else will produce a Maxima error.Fixed by commit [c2af73] which forces
$gnuplot_commandt o be a string.Related
Commit: [c2af73]
Thank you!