From norman.werner at web.de Wed Aug 24 19:20:35 2005 From: norman.werner at web.de (norman werner) Date: Wed, 24 Aug 2005 21:20:35 +0200 Subject: [cl-unification-devel] bugfix Message-ID: <583099743@web.de> Hello The match macro is (like several other macros as well ) definded as: (defmacro match ((template object^M &key^M (substitution (make-empty-environment))^M (errorp t)^M (error-value nil))^M &body forms)^M ..) when one tries to write somethind like: (dolist (template templates) (match template form)) it will not work as expected because all invocations of match share a common environment. A fix would be to simply quote (make-empty-environment). Greetings Norman Werner _________________________________________________________________________ Mit der Gruppen-SMS von WEB.DE FreeMail k?nnen Sie eine SMS an alle Freunde gleichzeitig schicken: http://freemail.web.de/features/?mc=021179 From marcoxa at cs.nyu.edu Wed Aug 24 20:53:35 2005 From: marcoxa at cs.nyu.edu (Marco Antoniotti) Date: Wed, 24 Aug 2005 16:53:35 -0400 Subject: [cl-unification-devel] bugfix In-Reply-To: <583099743@web.de> References: <583099743@web.de> Message-ID: On Aug 24, 2005, at 3:20 PM, norman werner wrote: > > Hello > > The match macro is (like several other macros as well ) definded as: > > (defmacro match ((template object^M > &key^M > (substitution (make-empty-environment))^M > (errorp t)^M > (error-value nil))^M > &body forms)^M > ..) > > > when one tries to write somethind like: > > (dolist (template templates) > (match template form)) Are you actually trying to to (dolist (template templates) (match (template ) form)) ? This is not the intended use to the form, as the TEMPLATE variable will appear literally in the call to UNIFY. You will have to use UNIFY directly to achieve what you want. Maybe a useful macro would be (with-substitution-variables (v1 v2 ... vN)
*) Then you could write (dolist (template templates) (with-substitution-variables (v1 v2 ... vN) (unify template object) )) Cheers -- Marco Antoniotti http://bioinformatics.nyu.edu 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. From norman.werner at web.de Wed Aug 24 21:32:49 2005 From: norman.werner at web.de (norman werner) Date: Wed, 24 Aug 2005 23:32:49 +0200 Subject: [cl-unification-devel] aargh Message-ID: <583105962@web.de> I wrote the last bugfix from memory only. The explanation was bullshit. However the fix remains valid Norman _________________________________________________________________________ Mit der Gruppen-SMS von WEB.DE FreeMail k?nnen Sie eine SMS an alle Freunde gleichzeitig schicken: http://freemail.web.de/features/?mc=021179 From norman.werner at web.de Wed Aug 24 21:38:50 2005 From: norman.werner at web.de (norman werner) Date: Wed, 24 Aug 2005 23:38:50 +0200 Subject: [cl-unification-devel] Bugreport Message-ID: <583194558@web.de> Hello (cl.ext.dacf.unification:unify #T(list 3 4) '(3 )) will result in an error. I don't really understand the following code but i think the problem is in "(unify (subseq a 0 (list-length vars)) vars env))". I don't know how to fix this right. A temporary solution could be to do something like (when (< (length a) (length vars)) (error 'unification-failurse)) Greetings Norman (defmethod unify ((a list) (b sequence-template) &optional (env (make-empty-environment))) (let ((template-lambda-list (sequence-template-lambda-list b)) (ll (list-length a)) ) (multiple-value-bind (vars optionals keys rest) (parse-extended-ordinary-lambda-list template-lambda-list :ordinary-variable-test #'valid-template-p :optional-variable-test #'valid-template-p :key-variable-test #'valid-template-p :rest-variable-test #'valid-template-p) (let* ((n-vars (list-length vars)) (n-optionals (list-length optionals)) (env (unify (subseq a 0 (list-length vars)) vars env))) (when (and optionals (>= ll (+ n-vars n-optionals))) (setf env (unify (subseq a n-vars (+ n-vars n-optionals)) optionals env))) (when (and rest (>= ll (+ n-vars n-optionals))) (setf env (unify (subseq a (+ n-vars n-optionals)) (first rest) env))) (when keys (warn "Sorry mathcing of keywords ~S not yet implemented." keys)) env)))) _________________________________________________________________________ Mit der Gruppen-SMS von WEB.DE FreeMail k?nnen Sie eine SMS an alle Freunde gleichzeitig schicken: http://freemail.web.de/features/?mc=021179 From marcoxa at cs.nyu.edu Wed Aug 24 22:41:57 2005 From: marcoxa at cs.nyu.edu (Marco Antoniotti) Date: Wed, 24 Aug 2005 18:41:57 -0400 Subject: [cl-unification-devel] Bugreport In-Reply-To: <583194558@web.de> References: <583194558@web.de> Message-ID: <744ef04b24b6261c375c367c89784d04@cs.nyu.edu> On Aug 24, 2005, at 5:38 PM, norman werner wrote: > > Hello > > > (cl.ext.dacf.unification:unify #T(list 3 4) '(3 )) > will result in an error. If the error is UNIFICATION-FAILURE, then it is correct. What is the error signalled? Cheers -- Marco > I don't really understand the following code but i think the problem is > in "(unify (subseq a 0 (list-length vars)) vars env))". > I don't know how to fix this right. > > A temporary solution could be to do something like > > (when (< (length a) (length vars)) > (error 'unification-failurse)) > > > Greetings > > Norman > > > > > (defmethod unify ((a list) (b sequence-template) &optional (env > (make-empty-environment))) > (let ((template-lambda-list (sequence-template-lambda-list b)) > (ll (list-length a)) > ) > (multiple-value-bind (vars optionals keys rest) > (parse-extended-ordinary-lambda-list template-lambda-list > :ordinary-variable-test > #'valid-template-p > :optional-variable-test > #'valid-template-p > :key-variable-test > #'valid-template-p > :rest-variable-test > #'valid-template-p) > > (let* ((n-vars (list-length vars)) > (n-optionals (list-length optionals)) > (env (unify (subseq a 0 (list-length vars)) vars env))) > (when (and optionals (>= ll (+ n-vars n-optionals))) > (setf env (unify (subseq a n-vars (+ n-vars n-optionals)) > optionals env))) > (when (and rest (>= ll (+ n-vars n-optionals))) > (setf env (unify (subseq a (+ n-vars n-optionals)) (first > rest) env))) > (when keys (warn "Sorry mathcing of keywords ~S not yet > implemented." keys)) > env)))) > _______________________________________________________________________ > __ > Mit der Gruppen-SMS von WEB.DE FreeMail k?nnen Sie eine SMS an alle > Freunde gleichzeitig schicken: > http://freemail.web.de/features/?mc=021179 > > > > _______________________________________________ > cl-unification-devel site list > cl-unification-devel at common-lisp.net > http://common-lisp.net/mailman/listinfo/cl-unification-devel > -- Marco Antoniotti http://bioinformatics.nyu.edu 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. From marcoxa at cs.nyu.edu Thu Aug 25 15:23:45 2005 From: marcoxa at cs.nyu.edu (Marco Antoniotti) Date: Thu, 25 Aug 2005 11:23:45 -0400 Subject: [cl-unification-devel] Bugreport In-Reply-To: <583364235@web.de> References: <583364235@web.de> Message-ID: <053fa70c64d63f5881234c912dafae4b@cs.nyu.edu> Ok. This is an easy one. Marco On Aug 25, 2005, at 12:57 AM, norman werner wrote: > > it is not an unification-error. > On sbcl it is > > "debugger invoked on a SB-KERNEL:BOUNDING-INDICES-BAD-ERROR in thread > 2890: > The bounding indices 0 and 2 are bad for a sequence of length 1." > > However this will almost certainly depend on the lisp used. > > Norman > > _______________________________________________________________________ > __ > Mit der Gruppen-SMS von WEB.DE FreeMail k?nnen Sie eine SMS an alle > Freunde gleichzeitig schicken: > http://freemail.web.de/features/?mc=021179 > > > -- Marco Antoniotti http://bioinformatics.nyu.edu 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.