[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Scheme-reports] Seeking review of sets and hash tables proposals



"Procedure properties" can be implemented using an eqv? hash table,
provided eqv? is specified to work on procedures.  I find this fact
funny in this context, both because of the recent angst about eqv?
operating on procedures in R7RS (that I was part of), and because such
an implementation strategy for hash functions is not actually
circular, since the proper hash function for eqv? itself can be
supplied by other means.

~Alexey

On Sat, May 25, 2013 at 3:04 PM, Per Bothner <per@x> wrote:
> On 05/25/2013 09:45 AM, Per Bothner wrote:
>> A 'comparator' data type might be still be worth considering.
>> I could work well with a small library of utility routines.
>> For example (ascending PROJ) and (descending PROJ) take a one-argument
>> "projection" function that is applied to the elements to be
>> compared.  Another useful utility (useful for sorting)
>> takes a list of comparators, where the first element is
>> the primary key, the second the secondary key, etc.
>>
>> Anyway, this is all very hand-wavy ...
>
> Another idea, focusing for now just on equivalance functions:
> If the language supports 'procedure properties' then one
> way to "bundle" an equivalance function with a hash function
> is to make the latter a property of the former.  For example,
> using Kawa's syntax:
>
> http://www.gnu.org/software/kawa/Procedure-properties.html
>
> One could define:
>
> (define-procedure my-eq?
>     equivalence-hash: (lambda (obj) (whatever-hash ... obj))
>     (lambda (obj1 obj2) (whatever-eq ... obj1 obj2))
>
> Then as user can do:
>
>    (make-hash-table my-eq?)
>
> and the implementation can extract the hash function as:
>    (procedure-property equivalence 'equivalence-hash)
> --
>         --Per Bothner
> per@x   http://per.bothner.com/
>
> _______________________________________________
> Scheme-reports mailing list
> Scheme-reports@x
> http://lists.scheme-reports.org/cgi-bin/mailman/listinfo/scheme-reports

_______________________________________________
Scheme-reports mailing list
Scheme-reports@x
http://lists.scheme-reports.org/cgi-bin/mailman/listinfo/scheme-reports