William,
a:='Fraction::SEX
is a lisp symbol. A lisp symbol is essentially the address of a data
structure
which is approximately
struct
symbol-function (pointer to code)
symbol-name (a string representation of the symbol)
symbol-package (the lisp package (a hash table pointer))
symbol-value (the value of the symbol)
symbol-plist (an association list hanging on the symbol)
a:="Fraction"::Sex
is a lisp string, a contiguous set of bytes containing character code
So
a:=SYMBOL_-NAME('Fraction::SEX)$Lisp (get the symbol-name from the
fraction struct)
b:="Fraction"::SEX (make a
string of bytes containing "Fraction")
EQ(a,b)$Lisp ==> () (are they
the same storage location? no)
c:=STRING_-EQUAL(a,b)$Lisp ==> T (are they the same
sequence of bytes? yes)
Tim
William Sit wrote:
Hi Waldek:
Thanks. That is exactly what I want. Good solution. So the
"trick" is to use ' instead of the string. So is the
following a bug?
a:='Fraction::SEX
Fraction Type:SExpression
b:="Fraction"::SEX
Fraction Type:SExpression
(a=b)@Boolean
false Type Boolean
That is, I was deceived by the output which looked the same.
Perhaps the output should have been ('Fraction) and
("Fraction") ??
Also,
destruct(a) or destruct(b) leads to an Error:
Function Selection for destruct
Arguments: SEX
[1] signature: SEX -> LIST SEX
implemented: slot (List $)$ from SEX
>> Error detected within library code:
Non-list
protected-symbol-warn called with (NIL)
William
Waldek Hebisch wrote:
William Sit wrote:
Gabriel:
Thanks for the response. Your script shows how to get the
parameters, not the constructor. I do not have OpenAxiom
installed (sorry). The question is whether I can test that
the constructor is Fraction, or otherwise (like
FiniteField) when the domain belongs to the category
Field.
Do you want something like this?
(10) -> a := Fraction(Integer)
(10) Fraction Integer
Type: Domain
(11) -> (opOf(devaluate(a)$Lisp)$Lisp = 'Fraction::SEX)@Boolean
(11) true
Type: Boolean
(12) -> (opOf(devaluate(a)$Lisp)$Lisp = 'FiniteField::SEX)@Boolean
(12) false
Type: Boolean
(13) -> a :=FiniteField(5,2)
(13) FiniteField(5,2)
Type: Domain
(14) -> (opOf(devaluate(a)$Lisp)$Lisp = 'Fraction::SEX)@Boolean
(14) false
Type: Boolean
(15) -> (opOf(devaluate(a)$Lisp)$Lisp = 'FiniteField::SEX)@Boolean
(15) true
Type: Boolean
--
Waldek Hebisch
hebi...@math.uni.wroc.pl
_______________________________________________
Axiom-developer mailing list
Axiom-developer@nongnu.org
http://lists.nongnu.org/mailman/listinfo/axiom-developer
_______________________________________________
Axiom-developer mailing list
Axiom-developer@nongnu.org
http://lists.nongnu.org/mailman/listinfo/axiom-developer