axiom-developer
[Top][All Lists]
Advanced

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

Re: [Axiom-developer] pointers


From: William Sit
Subject: Re: [Axiom-developer] pointers
Date: Mon, 09 Nov 2009 20:09:30 -0500

Tim:

Interesting. Is there a similar function that is more structural? say, can I test whether some domain (which may be passed as a parameter of type Field) is of the form Fraction(something) and if so, extract "something" (that is, assign it to a variable and further test it), sort of a deconstruction?

William

On Mon, 09 Nov 2009 19:51:45 -0500
 Tim Daly <address@hidden> wrote:
You can get a memory pointer to a lisp object.

a:=Fraction(Integer)

returns the "memory location of Fraction(Integer)"
You can prove this with

b:=Fraction(Integer)
EQ(a,b)$Lisp

The lisp function EQ compares memory pointers.

There is a lisp function to get the hash value of any object
call sxhash. You can call it.

SXHASH(a)$Lisp

Note that if

c:=Integer

then
EQ(a,c)$Lisp is false
SXHASH(a)$Lisp is not equal to SXHASH(c)$Lisp

Thus the hash function you seek already exists.
You just have to accept the fact that Spad is only syntactic
sugar for lisp code and lisp is not evil.

Tim



_______________________________________________
Axiom-developer mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/axiom-developer

William Sit, Professor Emeritus
Mathematics, City College of New York Office: R6/202C Tel: 212-650-5179
Home Page: http://scisun.sci.ccny.cuny.edu/~wyscc/




reply via email to

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