Subject: how to stop the annotation of lists by filenames?
From: Oliver Kullmann
Date: Fri, 30 May 2008 20:06:14 +0100
On Thu, May 29, 2008 at 01:04:44PM -0700, Richard Fateman wrote:
> how about not re-saving everything, but just incrementally what has
> changed, and then you won't have to write out such big files?
>
This looks relatively complicated, and likely needs hand-crafted
code for each single case. Currently we have something like, say 50,
functions which should have the option of saving intermediate results.
(Just at the moment I enumerate special minimally unsatisfiable
conjunctive normal forms, there are many other examples like that,
also enumerating for example hypergraphs in the search for counterexamples.
Then there are many functions enumerating different types of search trees
(the example shown is such a case), enumerating all solutions, all
isomorphisms, all colourings etc. The relevant cases typically search
for something special, so you run it a few days, if you are lucky, you find
it, otherwise you try again with a different part of the search space.)
Hopefully over time there will be hundreds of these functions.
So we need a simple and uniform method. And "save(session-name,all)"
seems perfectly reasonable.
I have a couple of questions on how to proceed further, and I hope
somebody can help:
1) It seems to me that it is when load(filename) is called that
the behaviour of the functions read (via mread) is determined.
That is, currently the filename etc. gets hard-coded into the function,
and all its output is annotated in this way, and this cannot be
changed.
2) So I need an alternative load-function, which calls an alternative
mread which uses the trivialised add-lineinfo.
Since I know only little about Lisp, and not much about the Maxima
core system, I'm unsure how to achieve this:
a) One could introduce a switch, but apparently this would need
a bigger surgery?
b) Perhaps easiest is to to create a new file, say, "NEW_mload.lisp",
which contains the definition of new_mload, just copied from the
existing sources, but using new_add-lineinfo (which is trivial).
This file would be injected into the src-directory at build-time,
hopefully compiled with the rest, and then I can choose between
these two load-versions, with or without annotations.
I would be glad for some tips how to achieve this in the most
sustainable way!
Oliver
P.S. Actually, I think offering such two versions of load
would be useful for other users as well.
>
> > Arrgh, this was too optimistic:
> >
> > Replacing the original add-lineinfo definition
> > by the trivial one passes all the Maxima-build tests,
> > and also mine (except of those designed to catch
> > the old behaviour), and apparently except of
> > two calls in nparse.lisp this function is
> > not used at all, but, alas, with the trivialised
> > version the error-function does not print out
> > the file-information about the error (exploited by
> > my little unit-test system).
> >
> > So a switch is needed, perhaps a boolean Maxima variable
> > "lineinfo" which when true triggers the use of the original
> > add-lineinfo function, while when false triggers the use
> > of the trivial replacement.
> >
> > I'm not sure how to handle this best.
> > Any opinions?
> >
> > Oliver
> >
> > On Thu, May 29, 2008 at 05:56:14PM +0100, Oliver Kullmann wrote:
> > > alright, this seems to work (passes my tests)!
> > > (I already thought, syntax looks fishy, but god knows
> > > what Lisp allows ;-).
> > >
> > > I guess, in order to avoid that redefinition-warning,
> > > I will replace the original definition of add-lineinfo
> > > in the sources with this one, and build Maxima in
> > > this way.
> > >
> > > Thanks!
> > >
> > > Oliver
> > >
> > >
> > > On Thu, May 29, 2008 at 12:17:58PM -0400, Stavros Macrakis wrote:
> > > > Try
> > > >
> > > > :lisp (defun add-lineinfo (lis) lis)
> > > >
> > > > -s
> > >
> > > --
> > > Dr. Oliver Kullmann
> > > Computer Science Department
> > > Swansea University
> > > Faraday Building, Singleton Park
> > > Swansea SA2 8PP, UK
> > > http://cs.swan.ac.uk/~csoliver/
> >
> > --
> > Dr. Oliver Kullmann
> > Computer Science Department
> > Swansea University
> > Faraday Building, Singleton Park
> > Swansea SA2 8PP, UK
> > http://cs.swan.ac.uk/~csoliver/
> > _______________________________________________
> > Maxima mailing list
> > Maxima at math.utexas.edu
> > http://www.math.utexas.edu/mailman/listinfo/maxima
> >
--
Dr. Oliver Kullmann
Computer Science Department
Swansea University
Faraday Building, Singleton Park
Swansea SA2 8PP, UK
http://cs.swan.ac.uk/~csoliver/