[cl-unification-devel] a simpler example

Russell McManus russell_mcmanus at yahoo.com
Wed Jun 11 14:04:18 UTC 2008


I'm pretty sure that I tried repeating the #T before sending my first email, but it failed with an error.

I just tried again on sbcl 1.0.10.16 and got the following:

(unify #T(list ?f #T(list ?s1 ?s2)) '(a (b c)))


Cannot unify two different symbols: B MAKE-TEMPLATE.
   [Condition of type CL.EXT.DACF.UNIFICATION::UNIFICATION-FAILURE]

Restarts:
 0: [ABORT] Return to SLIME's top level.
 1: [TERMINATE-THREAD] Terminate this thread (#<THREAD "worker" {1008AB0C91}>)

Any ideas what I should try next?

-russ



----- Original Message ----
> From: Marco Antoniotti <marcoxa at cs.nyu.edu>
> To: cl-unification-devel at common-lisp.net
> Sent: Tuesday, June 10, 2008 3:51:44 AM
> Subject: Re: [cl-unification-devel] a simpler example
> 
> 
> On Jun 6, 2008, at 24:38 , Russell McManus wrote:
> 
> >
> > Here are some examples:
> >
> > ;; this works
> > (find-variable-value
> >  '?s
> >  (unify #T(list ?f ?s) '(a (b c))))
> 
> Yes.
> 
> >
> > ;; this works
> > (find-variable-value
> >  '?s1
> >  (unify #T(list ?f (?s1 ?s2)) '(a (b c))))
> 
> Yes.
> 
> 
> >
> > ;; this fails
> > (find-variable-value
> >  '?s1
> >  (unify #T(list ?f (list ?s1 ?s2)) '(a (b c))))
> 
> As it should.  What you want is
> 
> (unify #T(list ?f #T(list ?s1 ?s2)) '(a (b c)))
> 
> In your case you are trying to unify a template of type LIST with a  
> variable in FIRST and a list (LIST ?s1 ?s2) in SECOND.  The second  
> element cannot unify with (B C), hence the failure.
> 
> >
> > I was expecting the meaning of LIST to be the same whether
> > it is encountered at top level in a template, or at a nested level.
> >
> > Is this a bug, or are my expectations wrong?
> 
> Sorry.  It is your expectations.  If you look at the most general  
> syntax for templates, you will see that it is #T(.  
> ).  This is because it would be a nightmare to do otherwise.
> 
> 
> Suppose you have a
> 
> (unify #T(list 42 (foo)) (list 42 (list 'foo)))
> 
> should unify.  But is next you do
> 
> (defstruct foo a s d)
> 
> then
> 
> (unify #T(list 42 (foo)) (list 42 (list 'foo)))
> 
> may or may not unify pending interpretation.
> 
> Hope this clarifies things.  Let me know if there are other pitfalls  
> or bugs in the code.
> 
> Cheers
> 
> Marco
> 
> 
> >
> 
> --
> Marco Antoniotti
> 
> 
> _______________________________________________
> cl-unification-devel site list
> cl-unification-devel at common-lisp.net
> http://common-lisp.net/mailman/listinfo/cl-unification-devel




More information about the cl-unification-devel mailing list