[plt-scheme] Vector / matrix benchmarks
Carl Eastlund skrev:
> On 9/6/06, Jens Axel Søgaard <jensaxel at soegaard.net> wrote:
>> I didn't get that far. The finite tables from Galore version 2,
>> won't run in 352. I wasn't aware of this problem till now.
>> Maybe a "singleton" something were added to the contracts
>> library?
>
> No, your contract was always wrong, but it was never caught until a
> recent update to the contract library.
Ah!
Good thing I never documented finite-tables. Unlike the other
parts of Galore, a test suite wasn't written and their interface
wasn't satisfactory. The tables of Galore 3 is better thought out.
> Now the first-order properties
> of a contract are tested as the exporting module is required, rather
> than waiting for the client module to use them.
> Singleton is a
> function that takes 2 or 3 arguments, but the arrow contract requires
> it to take 1 or 2 arguments. (The arrow contracts take 2 and 3
> arguments, perhaps the result type is missing?)
(singleton
(:case-> (:-> :any/c finite-map/c)
(:-> compare/c :any/c finite-map/c)))
I think I originally represented an association with a
struct (or a cons), and then later changed the representation,
so associations were implicit.
(define singleton
(case-lambda
[(x v) (insert (cons x v) (empty))]
[(cmp x v) (insert x v (empty cmp))]))
In any case the morale is clear: Don't use finite-tables from version 2.
--
Jens Axel Søgaard