The following program runs fine:

xxxx.input:

F := PF 5

(B1, B2, B3) : Vector F

SetVecs() ==
   free B1, B2, B3
   B1 := [1, 2, 3]
   B2 := [2, 3, 1]
   B3 := [3, 1, 2]
   output("")

GetMatx() ==
   free B1, B2, B3
   X : Matrix F
   X := matrix [B1, B2, B3]
   (output("X:", X); output(""))
   (output("Rank:", rank(X)); output(""))

SetVecs()
GetMatx()


(1) -> )r xxxx
F := PF 5


   (1)  PrimeField(5)

(B1, B2, B3) : Vector F


SetVecs() ==
   free B1, B2, B3
   B1 := [1, 2, 3]
   B2 := [2, 3, 1]
   B3 := [3, 1, 2]
   output("")


GetMatx() ==
   free B1, B2, B3
   X : Matrix F
   X := matrix [B1, B2, B3]
   (output("X:", X); output(""))
   (output("Rank:", rank(X)); output(""))


SetVecs()

   Compiling function SetVecs with type () -> Void

GetMatx()

   Compiling function GetMatx with type () -> Void
      ┌1  2  3┐
      │           │
   X: |  2  3  1│
      │           │
      └3  1  2┘

   Rank: 3


However, the same program fails when var X is replaced with T
in GetMatx():


tttt.input:

F := PF 5

(B1, B2, B3) : Vector F

SetVecs() ==
   free B1, B2, B3
   B1 := [1, 2, 3]
   B2 := [2, 3, 1]
   B3 := [3, 1, 2]
   output("")

GetMatx() ==
   free B1, B2, B3
   T : Matrix F
   T := matrix [B1, B2, B3]
   (output("T:", T); output(""))
   (output("Rank:", rank(T)); output(""))

SetVecs()
GetMatx()


With following errors:


(1) -> )r tttt
F := PF 5


   (1)  PrimeField(5)

(B1, B2, B3) : Vector F


SetVecs() ==
   free B1, B2, B3
   B1 := [1, 2, 3]
   B2 := [2, 3, 1]
   B3 := [3, 1, 2]
   output("")


GetMatx() ==
   free B1, B2, B3
   T : Matrix F
   T := matrix [B1, B2, B3]
   (output("T:", T); output(""))
   (output("Rank:", rank(T)); output(""))


SetVecs()

   Compiling function SetVecs with type () -> Void

GetMatx()

   Compiling function GetMatx with type () -> Void
; in: SB-INT:NAMED-LAMBDA |*0;GetMatx;1;frame1|
;     (BOOT::SPROG ((T NIL))
;                  (PROGN
;                   (BOOT::LETT T 'BOOT::UNINITIALIZED_VARIABLE 
BOOT::|GetMatx|)
;                   (PROGN
;                    (BOOT::|voidValue|)
;                    (BOOT::LETT T (BOOT::SPADCALL # #) BOOT::|GetMatx|)
;                    (PROGN (BOOT::SPADCALL "T:" # #) (BOOT::SPADCALL "" #))
;                    (PROGN (BOOT::SPADCALL "Rank:" # #) (BOOT::SPADCALL "" 
#)))))
; --> BLOCK
; ==>
;   (LET (T)
;     (PROGN
;      (BOOT::LETT T 'BOOT::UNINITIALIZED_VARIABLE BOOT::|GetMatx|)
;      (PROGN
;       (BOOT::|voidValue|)
;       (BOOT::LETT T (BOOT::SPADCALL # #) BOOT::|GetMatx|)
;       (PROGN (BOOT::SPADCALL "T:" # #) (BOOT::SPADCALL "" #))
;       (PROGN (BOOT::SPADCALL "Rank:" # #) (BOOT::SPADCALL "" #)))))
;
; caught ERROR:
;   COMMON-LISP:T names a defined constant, and cannot be used in LET.
;
; compilation unit finished
;   caught 1 ERROR condition

   >> System error:
   Execution of a form compiled with errors.
Form:
  (LET (T)
  (PROGN
   (LETT T 'UNINITIALIZED_VARIABLE |GetMatx|)
   (PROGN
    (|voidValue|)
    (LETT T
          (SPADCALL (|coerceOrCroak| # '# '|GetMatx|)
                    (QREFELT |*0;GetMatx;1;frame1;MV| 0))
          |GetMatx|)
    (PROGN
     (SPADCALL "T:" (SPADCALL T #) (QREFELT |*0;GetMatx;1;frame1;MV| 2))
     (SPADCALL "" (QREFELT |*0;GetMatx;1;frame1;MV| 3)))
    (PROGN
     (SPADCALL "Rank:" (SPADCALL # #) (QREFELT |*0;GetMatx;1;frame1;MV| 2))
     (SPADCALL "" (QREFELT |*0;GetMatx;1;frame1;MV| 3))))))
Compile-time error:
  COMMON-LISP:T names a defined constant, and cannot be used in LET.

   Continuing to read the file...


That seems a little strange....

Thanks,
Sid

-- 
You received this message because you are subscribed to the Google Groups 
"FriCAS - computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/fricas-devel/9bb421c4-35c8-4016-a391-598a2f035588n%40googlegroups.com.

Reply via email to