You are being nagged on because your project's
name showed up in the nightly Checkbot run. Checkbot checks
for broken links etc. This probably means that you are
either pointing to a broken link or that someone is pointing
to a broken link on your site. Or something else, it check's
a bunch of stuff. Update your webpages or you shall be nagged
again next week.
To find out what's wrong with your webpages, please consult:
http://common-lisp.net/checkbot/checkbot-common-lisp.net.html
Any questions? You can reach the author of this cronjob at
admin(a)common-lisp.net
Thanks!
Hello
While writing a library with prolog like capabilities on top of cl-unification and a home brewn nondeterministic library
I need a way to copy environments.
There is a (internal) function copy-env in cl-unification. So I exported it.
The problem is that this function returns a new environment which actually still shares
objects with its original argument.
Is this intentional?
If not I propose the following (code will certainly contain bug, because i write it from memory only)
(defun copy-env (e)
(make-environment :frames (mapcar #'copy-frame (frames e))))
(defun copy-frame (f)
(make-frame :bindings (mapcar #'copy-binding (binding f))))
(defun copy-binding (b)
(mapcar #'(lambda (cell) (cons (car cell)
(cdr cell))) b))
Norman
______________________________________________________________
Verschicken Sie romantische, coole und witzige Bilder per SMS!
Jetzt bei WEB.DE FreeMail: http://f.web.de/?mc=021193
Thanks Peter,
can you send me a diff of the changes you made?
Thanks
marco
On Nov 11, 2005, at 5:13 AM, Peter Mechlenborg wrote:
> Marco Antoniotti wrote:
>> On Nov 10, 2005, at 3:56 AM, Peter Julian Marstrand Mechlenborg wrote:
>>> Hi
>>>
>>> I have gotten cl-unification from CVS:
>>> [goblin:~/.asdf-install-dir/site]$cvs -z3 -d
>>> :pserver:anonymous:anonymous@common-lisp.net:/project/cl-
>>> unification/ cvsroot co
>>> cl-unification
>>>
>>> and I have used SBCL 0.9.6 and clisp-2.33.2.
>>>
>>> First some notes.
>>>
>>> - The macro match-case is not exported. Is this correct?.
>> Yep. I need to get back to work on this.
>
> I also changed the &rest argument in match-case to &body to get Slime
> to indent the macro better.
>
>>>
>>> - I think this code snippet in match-case:
>>>
>>> ...
>>> (otherwise-claus
>>> (if otherwise-clause-present-p
>>> (first (last clauses))
>>> ...
>>>
>>> should be replaced with this:
>>>
>>> ...
>>> (otherwise-clause
>>> (if otherwise-clause-present-p
>>> `(progn ,@(rest (first (last clauses))))
>>> ...
>>>
>>> Otherwise I get the error "the function: otherwise not defined".
>> Yes. This looks like a bug. Thanks for the report.
>> I cannot quite help you with the code below. I do not know what
>> BOUND-IDL-CLASSES is and so on.
>
> If you did, I would be really scared :-). It's something for my master,
> and not relevant.
>
> Here is a cleaned up version that seems to have the same problem.
>
> (defun nested-match-cases (input)
> (match-case (input)
> ((:a ?a :b ?bs)
> (loop for b in ?bs
> collect (match-case (b)
> ((:c ?c) ?c)
> ((:d ?d) ?d)
> (otherwise (error 'error-inner)))))
> (otherwise 'error-outer)))
>
>
>> However, I will fix the problems with CL-UNIFICATION ASAP.
>> Meanwhile, why don't you subscribe to the cl-unification-devel
>> mailing list?
>
> Just did!
>
>> Cheers
>> --
>> Marco
>
> -- Peter
>
--
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.
On Nov 10, 2005, at 3:56 AM, Peter Julian Marstrand Mechlenborg wrote:
> Hi
>
> I have gotten cl-unification from CVS:
> [goblin:~/.asdf-install-dir/site]$cvs -z3 -d
> :pserver:anonymous:anonymous@common-lisp.net:/project/cl-unification/
> cvsroot co
> cl-unification
>
> and I have used SBCL 0.9.6 and clisp-2.33.2.
>
> First some notes.
>
> - The macro match-case is not exported. Is this correct?.
Yep. I need to get back to work on this.
>
> - I think this code snippet in match-case:
>
> ...
> (otherwise-claus
> (if otherwise-clause-present-p
> (first (last clauses))
> ...
>
> should be replaced with this:
>
> ...
> (otherwise-clause
> (if otherwise-clause-present-p
> `(progn ,@(rest (first (last clauses))))
> ...
>
> Otherwise I get the error "the function: otherwise not defined".
Yes. This looks like a bug. Thanks for the report.
I cannot quite help you with the code below. I do not know what
BOUND-IDL-CLASSES is and so on.
However, I will fix the problems with CL-UNIFICATION ASAP.
Meanwhile, why don't you subscribe to the cl-unification-devel mailing
list?
Cheers
--
Marco
>
>
> Here comes my problem.
>
> I have this in a file (unify-problems.lisp):
>
> =Start============
>
> (in-package :unify)
>
> (defun check-bindings (interface-bindings)
> (match-case (interface-bindings)
>
> ((:interface ?interface-name :bindings ?binds)
> (let ((bound-idl-classes (loop for binding in ?binds
> collect (match-case (binding)
> ((:concrete-class ?_
> :idl-class
> ?idl-class-name)
> ?idl-class-name)
> ((:concrete-class ?foo
> :idl-class
> ?idl-class-name)
> ?idl-class-name)
> (otherwise
> (error "UTILS:
> Interface binding
> has wrong format: ~S"
> binding))))))
> bound-idl-classes))
>
> (otherwise (error "UTILS: Interface binding has wrong format: ~S"
> interface-bindings))))
>
> #|
> (check-bindings '(:interface |Set-interface| :bindings
> ((:concrete-class |SetC|
> :idl-class |Set|)
>
> (:concrete-class
> |BigSetC| :idl-class |BigSet|)
>
> (:concrete-class
> |BigSetC| :idl-class |BigSet|))))
> ==> (|Set| |BigSet| |BigSet|)
>
> (check-bindings '(:interface |Set-interface| :bindings
> ((:concrete-class |SetC|
> :idl-class |Set|)
>
> (:concrete-class
> |BigSetC| :idl-class |BigSet|))))
> ==> (|Set| |BigSet|)
>
> (check-bindings '(:interface |Set-interface| :bindings
> ((:concrete-class |SetC|
> :idl-class |Set|))))
>
> ==> (|Set|)
> |#
>
> =End===============
>
> When compiling the file with C-c-k in Slime I get 3 errors which I
> don't
> understand
> (only in SBCL, in Clisp it's ok). I can compile the function using
> C-c-c in
> Slime, but
> when I test it with the code in the comment above, I run into trouble
> again. The
> test
> only gives the correct result for the first test you run, no matter
> which one.
>
> Am I doing something stupid, or is this a bug? Hope you can help.
>
> Bye,
>
> -- Peter Mechlenborg
>
--
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.
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.
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.
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
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
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
Hi
thanks for the comments.
On May 27, 2005, at 12:25 PM, Robert P. Goldman wrote:
>
> I was following up on CL-UNIFICATION based on your email to the cells
> list, and read over the web site docs. I was left with the question
> of how to unify together two structures or objects. I see how one can
> unify a structure (or object) with a template, and how that might be
> used for ML-style pattern-matching.
>
> But what if you really want to know if two structures themselves
> unify? Presumably one might want to do something like the following:
>
> (setf x #S(FOO A 42 S NIL D NIL))
> (setf y #S(FOO A 42 S NIL D NIL))
>
> where x and y are EQUALP, but not EQ, and you'd like to do
>
> (unify x y)
>
> but this is impossible.
Ooops. Not good.
> Is the following correct:
>
> (unify x #T(FOO foo-a (foo-a y) foo-s (foo-s y) foo-d (foo-d y)))
Yes. This would work.
>
> and, if so, is there some less cumbersome way to make this happen?
> I.e., to have a unification method definition that would say "whenever
> I unify together a FOO and a FOO, I want to apply this template to the
> second argument?
You make a very good point.
Right now, the only defined methods for UNIFY with STRUCTURE-OBJECTs are
unify structure-object template
unify template structure-object
TRT would be to write a method for
unify structure-object structure-object
This would be a limited method in any case, just testing for equality
with EQUALP. E.g. given
(setf x #S(FOO A ?x))
(setf y #S(FOO A 42))
(unify x y)
would return an empty environment. I.e. the unifier would not recur
into the slots.
In alternative the unifier could generate two subtests
(unify x #T(FOO foo-a (foo-a y) foo-s (foo-s y) foo-d (foo-d y)))
(unify #T(FOO foo-a (foo-a x) foo-s (foo-s x) foo-d (foo-d x)) y)
This is needed to ensure cross unifications.
I know I could do away with all of this by invoking implementation
dependent code getting the structure slots. But I am kind of against
it. As it is the unification code is completely portable.
Yet, given enough pressure, I will concede and add the the extra code.
Cheers
Marco
PS. Do subscribe to the mailing lists. They are very low volume, but
most announcements and discussions go there.
--
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.