[cl-unification-devel] Re: cl-unification on CMUCL19b

Marco Antoniotti marcoxa at cs.nyu.edu
Thu Oct 27 15:21:12 UTC 2005


Hi

thanks for the interest.

On Oct 26, 2005, at 7:11 PM, karol skocik wrote:

> Hi Marco,
>   I started to play with your cl-unification library on
> CMUCL19b/Linux, but for some unknown reasons most of the examples on
> the web documentation does not work.
> Actually almost all templates except list and vector. Structure
> templates return mostly empty environment where they should return
> normal env.

Nope.  An "empty" environment is just an environment with no bindings.  
Technically the choice has been for UNIFY to return an environment 
(empty or not) on success and to signal an UNIFICATION-FAILURE 
condition otherwise.

> For example this:
>
> foo1 is the same as your foo class :
> (defclass foo1 () ((a :initform 42 :accessor foo1-a)))
> CL-USER> (unify (make-instance 'foo1) #T(foo1 foo1-a 42))
> #<EMPTY UNIFY ENVIRONMENT: 1 frame {589D0D0D}>

This is correct.  Try

(unify '(1 2 3) '(1 2 3))

you will see that it returns an empty environment as well.


>
> while this is ok :
> CL-USER> (unify (make-instance 'baz :b '?e) #T(baz bazb 42))
> #<UNIFY ENVIRONMENT: 1 frame {589BF4ED}>
> CL-USER> (find-variable-value '?e *)
> 42
> T

This is also correct.

> after changing the declarations :
> CL-USER> (defstruct foo () (a 42))
> Warning:  Change in instance length of class FOO:
>   current length: 4
>   new length: 3
> Warning:  Previously loaded FOO accessors will no longer work.
> FOO
> CL-USER> (defstruct (baz (:include foo)) (b 33))
> Warning:
>    Change in superclasses of class #<KERNEL::STRUCTURE-CLASS BAZ 
> {58A47025}>:
>   current superclasses: (T PCL::SLOT-OBJECT STANDARD-OBJECT)
>   new superclasses: (T INSTANCE STRUCTURE-OBJECT FOO)
> Warning:
>    Previously loaded #<KERNEL::STRUCTURE-CLASS BAZ
>                        {58A47025}> accessors will no longer work.
> Warning:
>    Changing meta-class of BAZ from KERNEL::STANDARD-CLASS to
> KERNEL::STRUCTURE-CLASS.
> BAZ
>
> this also return empty env :
> CL-USER> (unify (make-foo) #T(foo foo-a 42))
> #<EMPTY UNIFY ENVIRONMENT: 1 frame {58AB3F85}>
>
> for example this :
> CL-USER> (unify (make-instance 'baz :b '?e) #T(baz bazb 42))
> makes this error :
> Invalid initialization argument
>   :B
> in call for class #<STRUCTURE-CLASS BAZ {58AB5C05}>.

This is unrelated.  You have changed a class to a structure.  The 
constructor no longer works.

> from the others templates like :
> CL-USER> (unify "asdfasdfasdf" #T(elt 3 ?x))
> Error in function (METHOD UNIFY NIL
>                    (VECTOR CL.EXT.DACF.UNIFICATION::TEMPLATE)):
>    Cannot unify a vector with a non-vector template: "asdfasdfasdf" 
> #T(ELT 3
>                                                                        
>     ?X).
>    [Condition of type CL.EXT.DACF.UNIFICATION::UNIFICATION-FAILURE]

This seems like a bug.  Thanks for reporting it.

> CL-USER> (unify '(0 1 42 3 4 5) #T(nth 2 ?x))
> Error in function (METHOD UNIFY NIL (LIST 
> CL.EXT.DACF.UNIFICATION::TEMPLATE)):
>    Cannot unify a list with a non-list template: (0 1 42 3 4 5) #T(NTH 
> 2 ?X).
>    [Condition of type CL.EXT.DACF.UNIFICATION::UNIFICATION-FAILURE]

This seems like a bug too.

> ... in the attachment is the whole session (without error messages -
> is there any way to output them to REPL instead just "Evaluation
> aborted" ?) and also compile log. What might be a problem? Don't worry
> about that if you are busy. I am just playing & studying some nice
> lisp libs. After serious procedural brain damage I suffered on my
> "university", lisp is a showing me how deep the rabbit hole goes :)

Thanks again for the interest.  I will go into the code and see what 
can be done with the two bugs you reported.
You are most definitively welcome to dig in :)

Cheers

Marco

PS.  please join the cl-unification-devel mailoing list.  It is best 
for these discussions to go on.




--
Marco Antoniotti					http://bioinformatics.nyu.edu/~marcoxa
NYU Courant Bioinformatics Group		tel. +1 - 212 - 998 3488
715 Broadway 10th FL				fax. +1 - 212 - 998 3484
New York, NY, 10003, U.S.A.




More information about the cl-unification-devel mailing list