For racket it does not work out of the box, but for scheme srfi69 allows for 
arbitrary equality predicates and specialized hash functions. I believe r6rs 
hashtables has a string-CI-hash, but I can be wrong.

For the racket port I removed that functionality, since I couldn't do it easily 
using the default hash tables. For that you can use make-custom-hash: 
https://docs.racket-lang.org/reference/dicts.html?q=hash#%28def._%28%28lib._racket%2Fdict..rkt%29._make-custom-hash%29%29
 b

You could just wrap the hash function with something that normalizes strings 
and chars and whatever other data types you think you can use, but that would 
mean an eternal chase for edge cases.

-- 
  Linus Björnstam

On Tue, 10 Dec 2019, at 19:54, Jack Firth wrote:
> > The "tdelete-duplicates" uses a hash-table to store already seen 
> elements: if the element is in the hash table, just filter it out. If 
> it is not, we do: (hash-set! already-seen element #t). That should be 
> constant timeish.
> I understand how that works for the usual eq? / eqv? / equal? equality 
> relations, but how could that work for *arbitrary* equivalence 
> relations? If you passed a case-insensitive string comparison function 
> to tdelete-duplicates, storing already seen elements in a hash table 
> wouldn't help because two "equal" strings could have different hash 
> codes.
> 
>  -- 
>  You received this message because you are subscribed to the Google 
> Groups "Racket Users" group.
>  To unsubscribe from this group and stop receiving emails from it, send 
> an email to racket-users+unsubscr...@googlegroups.com.
>  To view this discussion on the web visit 
> https://groups.google.com/d/msgid/racket-users/90506548-c7fc-4f0d-9321-00cb03490aec%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/racket-users/90506548-c7fc-4f0d-9321-00cb03490aec%40googlegroups.com?utm_medium=email&utm_source=footer>.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/7f77372c-8512-48ce-a70c-4182b61fc197%40www.fastmail.com.

Reply via email to