[cl-unification-devel] sequence template bug?

Marco Antoniotti marcoxa at cs.nyu.edu
Sat Feb 19 09:00:31 UTC 2011


Yep.  That makes sense.  The only caveat is that VECTOR-TEMPLATEs check some extra features of vectors.
The unifier does not do much with this at this time, but it could.

In any case, go ahead with the patch.  Nothing will prevent us from re-introducing a more specialized

	unify (a vector) (vt vector-template)

later on.

Cheers


Marco



On Feb 17, 2011, at 21:19 , Robert Brown wrote:

> I think vectors should unify with sequence templates.  This expression
> 
>    (unify #(0 1 42 3 4 5) #T(sequence 0 1 ?x 3 4 5))
> 
> currently fails.  How does the following patch look?
> 
> bob
> 
> ==========
> 
> 
> *** test/unification-tests.lisp#1	Wed Feb 16 16:51:33 2011
> --- test/unification-tests.lisp	Thu Feb 17 15:06:27 2011
> ***************
> *** 99,104 ****
> --- 99,106 ----
>      (test t (unify:environment-p (unify #C(0 1) #T(complex #C(0 1)))))
> 
>      (test '(42 T) (v? '?x (unify #T(number ?x) 42)) :multiple-values t)
> +     (test '(42 T) (v? '?x (unify #(0 1 42 3 4 5) #T(sequence 0 1 ?x 3 4 5)))
> +           :multiple-values t)
> 
>      (test-error (unify 42 #T(float 42.0))
>                  :condition-type 'unification-failure
> 
> *** unifier.lisp#1	Wed Feb 16 16:51:33 2011
> --- unifier.lisp	Thu Feb 17 15:09:24 2011
> ***************
> *** 476,482 ****
>           :format-arguments (list a b)))
> 
> 
> ! (defmethod unify ((a vector) (b vector-template)
>                    &optional (env (make-empty-environment))
>                    &key &allow-other-keys)
>    (let ((template-lambda-list (sequence-template-lambda-list b))
> --- 476,482 ----
>           :format-arguments (list a b)))
> 
> 
> ! (defmethod unify ((a vector) (b sequence-template)
>                    &optional (env (make-empty-environment))
>                    &key &allow-other-keys)
>    (let ((template-lambda-list (sequence-template-lambda-list b))
> 
> _______________________________________________
> cl-unification-devel site list
> cl-unification-devel at common-lisp.net
> http://common-lisp.net/mailman/listinfo/cl-unification-devel
> 

--
Marco Antoniotti


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/cl-unification-devel/attachments/20110219/c47ba7ba/attachment.html>


More information about the cl-unification-devel mailing list