Re: more corrections for SRFI 132
William D Clinger 10 Mar 2016 19:37 UTC
In my previous message, I wrote:
> The current draft's specification of list-merge! ends by saying:
>
> It returns the deduplicated input. It returns an unspecified value.
I should add that both of those sentences are incorrect.
I have written a test program for SRFI 132, which is available here:
https://github.com/larcenists/larceny/blob/master/lib/SRFI/test/srfi-132-test.sps7
That test program imports (srfi 132 plus) instead of (srfi 132) because
Olin's test harness calls several procedures that aren't part of SRFI
132. The (srfi 132 plus) library is defined in the same file as the
(srfi 132) library I'm using in Larceny:
https://github.com/larcenists/larceny/blob/master/lib/SRFI/srfi/132.sld
If you examine the (srfi 132) library's definition, you will see it
defines three procedures that should have been defined by the reference
implementation but were not:
vector-find-median
vector-find-median!
vector-select!
In addition to that omission, the following procedures behave incorrectly
when passed a start argument or start and end arguments:
vector-stable-sort
vector-stable-sort!
Will
Summary of known bugs:
(vector-stable-sort > (vector 987) 1)
=> #(987)
instead of #()
(vector-stable-sort > (vector 9 8 6 3 0 4 2 5 7 1) 3)
=> #(7 5 4 3 2 1 0 5 7 1)
instead of #(7 5 4 3 2 1 0)
(vector-stable-sort (lambda (x y)
(> (quotient x 2)
(quotient y 2)))
(vector 9 8 6 3 0 4 2 5 7 1)
3)
=> #(7 4 5 3 2 0 1 5 7 1)
instead of #(7 4 5 3 2 0 1)
(vector-stable-sort > (vector 987) 1 1)
=> #(987)
instead of #()
(vector-stable-sort > (vector 987 654) 1 2)
=> #(987 654)
instead of #(654)
(vector-stable-sort > (vector 9 8 6 3 0 4 2 5 7 1) 2 6)
=> #(6 4 3 0 0 4 2 5 7 1)
instead of #(6 3 0 4)
(vector-stable-sort (lambda (x y)
(> (quotient x 2)
(quotient y 2)))
(vector 9 8 6 3 0 4 2 5 7 1)
1 8)
=> #(8 6 4 5 3 2 0 5 7 1)
instead of #(8 6 4 5 3 2 0)
(let ((v (vector 9 8 6 3 0 4 2 5 7 1)))
(vector-stable-sort! > v 3)
v)
=> #(7 5 4 3 2 1 0 5 7 1)
instead of #(9 8 6 7 5 4 3 2 1 0)
(let ((v (vector 9 8 6 3 0 4 2 5 7 1)))
(vector-stable-sort! (lambda (x y)
(> (quotient x 2)
(quotient y 2)))
v 3)
v)
=> #(7 4 5 3 2 0 1 5 7 1)
instead of #(9 8 6 7 4 5 3 2 0 1)
(let ((v (vector 9 8 6 3 0 4 2 5 7 1)))
(vector-stable-sort! > v 2 6)
v)
=> #(6 4 3 0 0 4 2 5 7 1)
instead of #(9 8 6 3 0 4 2 5 7 1)
(let ((v (vector 9 8 6 3 0 4 2 5 7 1)))
(vector-stable-sort! (lambda (x y)
(> (quotient x 2)
(quotient y 2)))
v 1 8)
v)
=> #(8 6 4 5 3 2 0 5 7 1)
instead of #(9 8 6 4 5 3 2 0 7 1)