login  home  contents  what's new  discussion  bug reports     help  links  subscribe  changes  refresh  edit

Submitted by : (unknown) at: 2007-11-17T22:34:27-08:00 (16 years ago)
Name :
Axiom Version :
Category : Severity : Status :
Optional subject :  
Optional comment :

This page demonstrages a bug with setelt.

From the first report by Bill Wood:

http://lists.nongnu.org/archive/html/axiom-mail/2007-08/msg00012.html

fricas
init_rec() == (r : Record(k: INT, rad: INT) := [0,0]; r)
Type: Void
fricas
xs := [init_rec() for i in 1..3];
fricas
Compiling function init_rec with type () -> Record(k: Integer,rad: 
      Integer)
Type: List(Record(k: Integer,rad: Integer))
fricas
ys := oneDimensionalArray(xs);
Type: OneDimensionalArray?(Record(k: Integer,rad: Integer))
fricas
xs(2).k := 5
The form on the left hand side of an assignment must be a single variable, a Tuple of variables or a reference to an entry in an object supporting the setelt operation. xs.2.k := 5
The form on the left hand side of an assignment must be a single variable, a Tuple of variables or a reference to an entry in an object supporting the setelt operation. ys(2).k := 10
The form on the left hand side of an assignment must be a single variable, a Tuple of variables or a reference to an entry in an object supporting the setelt operation. ys.2.k := 5
The form on the left hand side of an assignment must be a single variable, a Tuple of variables or a reference to an entry in an object supporting the setelt operation.

Here is a demonstration that shows that the Aldor compiler has no problem with that construction.

aldor
#include "axiom"
INT ==> Integer;
R ==> Record(k: INT, rad: INT);
initrec(): R == [0,0];
myfoo(): OneDimensionalArray R == {
  xs: List R := [initrec() for i in 1..3];
  ys: OneDimensionalArray R := oneDimensionalArray(xs);
  ys(2).k := 10;
  ys
}
aldor
   Compiling FriCAS source code from file 
      /var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/3344069441329748634-25px002.as
      using AXIOM-XL compiler and options 
-O -Fasy -Fao -Flsp -laxiom -Mno-ALDOR_W_WillObsolete -DAxiom -Y $AXIOM/algebra -I $AXIOM/algebra
      Use the system command )set compiler args to change these 
      options.
Program fault (segmentation violation).#1 (Error) Program fault (segmentation violation).
   The )library system command was not called after compilation.

fricas
zs:=myfoo()
There are no library operations named myfoo Use HyperDoc Browse or issue )what op myfoo to learn if there is any operation containing " myfoo " in its name.
Cannot find a no-argument definition or library operation named myfoo .

And the following code demonstrates that the problem lies in the interpreter and not in the SPAD compiler.

spad
)abbrev package BBB MyPkg
INT==> Integer R ==> Record(k: INT, rad: INT)
MyPkg(): with myfoo2: () -> OneDimensionalArray R == add initrec2(): R == [0,0]
myfoo2(): OneDimensionalArray R == xs: List R := [initrec2() for i in 1..3] ys: OneDimensionalArray R := oneDimensionalArray(xs) ys(2).k := 10 ys
spad
   Compiling FriCAS source code from file 
      /var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/8672852723378779648-25px004.spad
      using old system compiler.
   BBB abbreviates package MyPkg 
------------------------------------------------------------------------
   initializing NRLIB BBB for MyPkg 
   compiling into NRLIB BBB 
   compiling local initrec2 : () -> Record(k: Integer,rad: Integer)
      BBB;initrec2 is replaced by CONS00 
Time: 0 SEC.
compiling exported myfoo2 : () -> OneDimensionalArray Record(k: Integer,rad: Integer) Time: 0 SEC.
(time taken in buildFunctor: 0)
;;; *** |MyPkg| REDEFINED
;;; *** |MyPkg| REDEFINED Time: 0.01 SEC.
Cumulative Statistics for Constructor MyPkg Time: 0.01 seconds
finalizing NRLIB BBB Processing MyPkg for Browser database: --->-->MyPkg(constructor): Not documented!!!! --->-->MyPkg((myfoo2 ((OneDimensionalArray (Record (: k (Integer)) (: rad (Integer))))))): Not documented!!!! --->-->MyPkg(): Missing Description ; compiling file "/var/aw/var/LatexWiki/BBB.NRLIB/BBB.lsp" (written 15 APR 2014 05:29:48 PM):
; /var/aw/var/LatexWiki/BBB.NRLIB/BBB.fasl written ; compilation finished in 0:00:00.017 ------------------------------------------------------------------------ MyPkg is now explicitly exposed in frame initial MyPkg will be automatically loaded when needed from /var/aw/var/LatexWiki/BBB.NRLIB/BBB

fricas
zs:=myfoo2()

\label{eq1}\left[{\left[{k = 0}, \:{rad = 0}\right]}, \:{\left[{k ={10}}, \:{rad = 0}\right]}, \:{\left[{k = 0}, \:{rad = 0}\right]}\right](1)
Type: OneDimensionalArray?(Record(k: Integer,rad: Integer))

Status: open => closed




  Subject: (replying)   Be Bold !!
  ( 14 subscribers )  
Please rate this page: