[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Axiom-developer] set function breakage

From: root
Subject: [Axiom-developer] set function breakage
Date: Tue, 22 Jul 2003 18:15:24 -0400


> What I am actually looking for is a simpler example of
> an Axiom set function that actually fails. So far nothing
> seems wrong. 

Why do you believe that the Set function fails?
The example of sets failing that I gave was actually a GCL
common lisp example vs CCL common lisp. It was not an Axiom
level failure. (To recall, the example was:

(setq a '(a))
(setq b '(b c))
in GCL:
(set-difference b a) ==> (c b)
in CCL:
(set-difference b a) ==> (b c)

Both of these results are correct as they are both valid sets
and the order of the result of set-difference is unspecified).

The main Axiom failure is actually in the compiler. If you do:

(1) -> )co xpoly )con XPR

the compile will eventually die with a stack overflow. The above
command says to compile the domain XPR from xpoly.spad. This
will eventually involve walking the tree of domains that XPR
uses. Walking this tree involves finding all of the domains it
depends on and adding them to a list to be processed (the DEPENDS list).
Each domain in the DEPENDS list now needs to be processed in the
same way so the DEPENDS list is augmented with yet more domains.
Somewhere this process gets lost and the domain Ring shows up
in an infinite regression. It is not yet apparent to me why this
happens but since the original system can compile XPR (a CCL system)
and the new system cannot (a GCL system) I suspect a difference in
the underlying definition of the common lisp primitives. So far
the set-difference order is the only one I've found. It is a very
tedious process to follow the compiler (especially since it isn't
documented, sigh) and the first direct common lisp primitive shows
up about 80 levels deep in the execution stack. Nevertheless, all
of the code is there so there is no magic. 

If you want to watch the domain-level functions get called from
a particular domain (e.g CHAR) you can look in the int/algebra
directory. You will find either CHAR.lsp or CHAR.NRLIB/code.lsp.
That file will contain the lisp code that results from compiling
the domain. You can trace any (or all) functions from that domain.
(Indeed there is a file called "monitor.lisp.pamphlet" that will
do those kind of things. It exists only for debugging reasons).

If you want to trace CHAR operations you can look at this lisp
code, load it as interpreted code, and watch it execute. type:

)cd (yourpath)/int/algebra
)lisp (load "CHAR.NRLIB/code.lsp")
)lisp (trace |CHAR;=;2$B;1|)
)lisp (trace |CHAR;<;2$B;2|)

(look at the code.lsp file for the rest of the names).

Generally, for debugging I create a file called d.lisp
that contains a sequence of commands so I can rerun them
every time I restart Axiom. So, for instance, my current
file says things like:

(in-package "BOOT")   ;;; where Axiom runs
(defun S- (l1 l2)
 (reverse (set-difference l1 l2 :test #'equal)))
(defun S- (l1 l2)
 (reverse (set-difference l1 l2 :test #'equal)))
(load "RING.NRLIB/code.lsp")
... etc

Then when I start Axiom I type:

)lisp (load "/tmp/d.lisp")

Additionally it is sometimes helpful to run debugsys rather than
interpsys. Common lisp gives you some debugging facilities. For example,
trace takes conditions that allow you to control what it does. Also
you can use the step function. So you can type:

)lisp (step (+ (* 2 4) 5))

and watch each step of the evaluation. Since all of Axiom is really
just common lisp (boot files turn into int/interp/fn.clisp files,
spad files become int/interp/fn.NRLIB/code.lsp files and 
lisp files just become int/interp/lisp files) you can watch anything

The best place to look for the failure is likely in some subfunction
of |knownInfo|. You can watch this function execute by typing:

)lisp (setq *print-arry* t)    ;; show the contents of vectors
)lisp (setq *print-circle* t)  ;; watch for circular structures
)lisp (setq *print-pretty* t)  ;; indent reasonably
)lisp (setq *print-length* 5)  ;; limit the length to some value
)lisp (setq *print-level* 5)   ;; limit the depth to some value
)lisp (trace |knownInfo|)
)co xpoly )con XPR           

Let me know if you have any other questions. 


reply via email to

[Prev in Thread] Current Thread [Next in Thread]