is #'equalp OK for structures? 
Author Message
 is #'equalp OK for structures?

   I want to compare two structures.  The following code returns T,
which is what I want.  Is there a `better accepted' way to test for
equality of differing structures?  Thanks.

   (defstruct node name and other stuff here)
   (equalp (make-node)(make-node))
--
Hovig Heghinian                             | `To associate the word
Department of Computer Science              |  fuzzy with the word
University of Illinois at Urbana-Champaign  |  logic is shocking.'



Tue, 06 Aug 1996 11:43:25 GMT  
 is #'equalp OK for structures?

Quote:

>   I want to compare two structures.  The following code returns T,
>which is what I want.  Is there a `better accepted' way to test for
>equality of differing structures?  Thanks.

>   (defstruct node name and other stuff here)
>   (equalp (make-node)(make-node))

P.109 of CLtL2 explains precisely how EQUALP should behave for structures,
as clarified by X3J13.  Briefly, it returns T if the structures are the
same type and all the slots are EQUALP.

Whether this is what you want isn't obvious from your example, since you
don't show what the slots contain (so whether recursively comparing them
with EQUALP is appropriate for your application).

--
Barry Margolin
System Manager, Thinking Machines Corp.




Wed, 07 Aug 1996 12:55:46 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. CASE using #'equalp

2. 'who am i' from unix

3. Buttons: Mac OK, Windows not OK

4. CAN error out--OK(1073094667) and OK(1073094763)

5. Why is '?' OK in a method name and not OK in a variable name ?

6. OK OK, one more plaything

7. WeakDict's: addressing CPython's problem with cyclic structures

8. 'pstruct' structure parser and python

9. Overloaded '=' operator on a structured type

10. methods in 'C' - persistent data structures

11. OK, So I've Got This Project...

 

 
Powered by phpBB® Forum Software