euslisp / EusLisp

EusLisp is an integrated programming system for the research on intelligent robots based on Common Lisp and Object-Oriented programming. [Manual](http://euslisp.github.io/EusLisp/manual.html ) [マニュアル](http://euslisp.github.io/EusLisp/jmanual.html )
Other
57 stars 50 forks source link

assocのkey引数の取り扱いにバグがある. #436

Open inabajsk opened 4 years ago

inabajsk commented 4 years ago

(assoc 'b '(((a) 1) ((b) 2)) :key #'car) -> ((b) 2) となるべきところ, eusgl$ (assoc 'b '(((a) 1) ((b) 2)) :key #'car) ->nil となる.現状では, eusgl$ (assoc 'b '(((a) 1) ((b) 2)) :key #'caar) ->((b) 2) とよけいにcarを与える必要があり,間違っている.

eus/lisp/c/lists.cのSUPERASSOC の if (key==NIL) temp=ccar(target); else temp=call1(ctx,key,target); のところが, if (key==NIL) temp=ccar(target); else temp=call1(ctx,key,ccar(target)); となれば,大丈夫なはず.

Affonso-Gui commented 4 years ago

This problem has already been verified during the ansi-test project, and is fixed in the cl-compatible branch https://github.com/euslisp/EusLisp/pull/313.

However, because it changes previous behavior it will need a lot of practical testing before we can actually include the fixes on the master branch.

(On a related note, this and others cl-compatible fixes are also included in my development branch for the resumption system, which I am planning to make available as another branch as soon as I can get it stable.