This is the mail archive of the kawa@sourceware.org mailing list for the Kawa project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Bug in assoc


On 11/24/2010 03:21 PM, Jamison Hope wrote:
According to the SRFI-1 description of assoc:

The comparison procedure is used to compare the elements ei of list to
the key parameter in this way:
(= key (car ei)) ; list is (E1 ... En)
That is, the first argument is always key, and the second argument is
one of the list elements. Thus one can reliably find the first entry
of alist whose key is greater than five with
(assoc 5 alist <)

However, the implementation in kawa.lib.lists passes key as the second argument instead: (if (test pair:car x) pair which means that (assoc 5 alist <) will find the first entry of alist whose key is *less than* five.

Thanks! Fix checked in. -- --Per Bothner per@bothner.com http://per.bothner.com/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]