From mantoniotti at common-lisp.net Tue Jan 18 14:46:42 2011 From: mantoniotti at common-lisp.net (mantoniotti) Date: Tue, 18 Jan 2011 09:46:42 -0500 Subject: [cl-unification-cvs] CVS cl-unification Message-ID: Update of /project/cl-unification/cvsroot/cl-unification In directory cl-net:/tmp/cvs-serv17948 Added Files: .cvsignore Log Message: Added .cvsignore file. --- /project/cl-unification/cvsroot/cl-unification/.cvsignore 2011/01/18 14:46:42 NONE +++ /project/cl-unification/cvsroot/cl-unification/.cvsignore 2011/01/18 14:46:42 1.1 *.*fasl *.*fsl From mantoniotti at common-lisp.net Tue Jan 18 14:48:02 2011 From: mantoniotti at common-lisp.net (mantoniotti) Date: Tue, 18 Jan 2011 09:48:02 -0500 Subject: [cl-unification-cvs] CVS cl-unification Message-ID: Update of /project/cl-unification/cvsroot/cl-unification In directory cl-net:/tmp/cvs-serv18024 Modified Files: substitutions.lisp Log Message: Added debugging functions DUMP-FRAME and DUMP-ENVIRONMENT. --- /project/cl-unification/cvsroot/cl-unification/substitutions.lisp 2009/04/15 10:17:48 1.5 +++ /project/cl-unification/cvsroot/cl-unification/substitutions.lisp 2011/01/18 14:48:02 1.6 @@ -182,6 +182,18 @@ (mapcan #'frame-values (environment-frames env))) +;;;--------------------------------------------------------------------------- +;;; Simple debugging. +(defun dump-frame (f &optional (out *standard-output*)) + (declare (type frame f)) + (terpri out) + (loop for (var . value) in (frame-bindings f) + do (format out "~A~VT= ~A~%" var 8 value)) + ) + +(defun dump-environment (env &optional (out *standard-output*)) + (declare (type environment env)) + (map nil #'(lambda (f) (dump-frame f out)) (environment-frames env))) ;;;; end of file -- substitutions.lisp -- From mantoniotti at common-lisp.net Tue Jan 18 14:50:17 2011 From: mantoniotti at common-lisp.net (mantoniotti) Date: Tue, 18 Jan 2011 09:50:17 -0500 Subject: [cl-unification-cvs] CVS cl-unification Message-ID: Update of /project/cl-unification/cvsroot/cl-unification In directory cl-net:/tmp/cvs-serv18091 Modified Files: unifier.lisp Log Message: After a careful reading of PAIP fixed a very subtle bug in VAR-UNIFY that prevented the correct unification of: (?x ?y a) with (?y ?x ?x) --- /project/cl-unification/cvsroot/cl-unification/unifier.lisp 2009/12/17 16:44:46 1.7 +++ /project/cl-unification/cvsroot/cl-unification/unifier.lisp 2011/01/18 14:50:17 1.8 @@ -880,6 +880,8 @@ (defgeneric occurs-in-p (var pat env)) + +#+old-version-no-paip (defun var-unify (var pat env) (if (eq var pat) env @@ -896,6 +898,33 @@ (extend-environment var pat env)))))) +;;; Version with PAIP test. + +(defun var-unify (var pat env) + (if (eq var pat) + env + (multiple-value-bind (value foundp) + (find-variable-value var env) + + (cond (foundp + (unify value pat env)) + ((variablep pat) + (multiple-value-bind (pat-value foundp) + (find-variable-value pat env) + (if foundp + (return-from var-unify + (unify var pat-value env))) + ))) + + (cond ((and *occurrence-check-p* + (occurs-in-p var pat env)) + (error 'unification-failure + :format-control "Variable ~S occurs in ~S." + :format-arguments (list var pat))) + (t + (extend-environment var pat env)))))) + + #|| (defmethod occurs-in-p ((var symbol) pat env) From mantoniotti at common-lisp.net Tue Jan 18 14:53:20 2011 From: mantoniotti at common-lisp.net (mantoniotti) Date: Tue, 18 Jan 2011 09:53:20 -0500 Subject: [cl-unification-cvs] CVS cl-unification Message-ID: Update of /project/cl-unification/cvsroot/cl-unification In directory cl-net:/tmp/cvs-serv18168 Modified Files: ChangeLog Log Message: ChangeLog updated. --- /project/cl-unification/cvsroot/cl-unification/ChangeLog 2009/12/17 17:02:42 1.8 +++ /project/cl-unification/cvsroot/cl-unification/ChangeLog 2011/01/18 14:53:20 1.9 @@ -1,3 +1,39 @@ +2011-01-18 author + + * unifier.lisp: + After a careful reading of PAIP fixed a very subtle bug in VAR-UNIFY + that prevented the correct unification of: + + (?x ?y a) + + with + + (?y ?x ?x) + + * substitutions.lisp: + Added debugging functions DUMP-FRAME and DUMP-ENVIRONMENT. + + * .cvsignore: Added .cvsignore file. + +2009-12-17 author + + * ChangeLog: ChangeLog updated. + + * lib-dependent/cl-ppcre-template.asd: Initial checkin. + + * lib-dependent/cl-ppcre-template.lisp: + Patched to use Cl-PPCRE:SCAN-TO-STRINGS (thanks to Pixel // pinterface [a] gmail dot com). + + * unifier.lisp: Minor cosmetic changes. + + * unification-package.lisp: Exported MATCHF-CASE. + + * templates-hierarchy.lisp: + Fixed a couple of problems with some accessors in the NUMBER, + STRUCTURE-OBJECT and STANDARD-OBJECT templates. + + * match-block.lisp: Added MATCHF* macros. + 2009-12-17 author * lib-dependent/cl-ppcre-template.asd: Initial checkin. From mantoniotti at common-lisp.net Tue Jan 18 14:54:08 2011 From: mantoniotti at common-lisp.net (mantoniotti) Date: Tue, 18 Jan 2011 09:54:08 -0500 Subject: [cl-unification-cvs] CVS cl-unification Message-ID: Update of /project/cl-unification/cvsroot/cl-unification In directory cl-net:/tmp/cvs-serv18209 Modified Files: COPYING Log Message: Copyright dates updated. --- /project/cl-unification/cvsroot/cl-unification/COPYING 2009/04/15 10:14:59 1.5 +++ /project/cl-unification/cvsroot/cl-unification/COPYING 2011/01/18 14:54:08 1.6 @@ -1,4 +1,4 @@ -Copyright (c) 2004-2009 Marco Antoniotti +Copyright (c) 2004-2011 Marco Antoniotti All rights reserved. Permission is hereby granted, without written agreement and without From mantoniotti at common-lisp.net Tue Jan 18 14:55:22 2011 From: mantoniotti at common-lisp.net (mantoniotti) Date: Tue, 18 Jan 2011 09:55:22 -0500 Subject: [cl-unification-cvs] CVS cl-unification Message-ID: Update of /project/cl-unification/cvsroot/cl-unification In directory cl-net:/tmp/cvs-serv18250 Modified Files: README Log Message: Copyright dates updated. --- /project/cl-unification/cvsroot/cl-unification/README 2008/07/13 13:30:28 1.4 +++ /project/cl-unification/cvsroot/cl-unification/README 2011/01/18 14:55:22 1.5 @@ -1,6 +1,6 @@ CL-UNIFICATION -Marco Antoniotti (c) 2004-2008 +Marco Antoniotti (c) 2004-2011 The directory containing this file you are reading should contain the code and the documentation of the CL-UNIFICATION package.