handling duplicate elements Kevin Wortman (02 Jul 2014 17:05 UTC)
Re: handling duplicate elements John Cowan (02 Jul 2014 18:10 UTC)
Re: handling duplicate elements Kevin Wortman (06 Jul 2014 18:58 UTC)
Re: handling duplicate elements John Cowan (07 Jul 2014 04:01 UTC)
Re: handling duplicate elements Kevin Wortman (10 Jul 2014 21:30 UTC)
Re: handling duplicate elements John Cowan (11 Jul 2014 02:39 UTC)

Re: handling duplicate elements John Cowan 11 Jul 2014 02:39 UTC

Kevin Wortman scripsit:

> I guess that's sufficient for my association set application; I can change
> a mapping by removing any pre-existing association then adjoining a new
> one. It's not ideal, though, since that is two data structure operations
> instead of just one.

That's precisely where you want to use `set-replace!`:

	(set-replace! set new-pair new-pair)

will remove any existing pair that is equal to new-pair in the sense
of the comparator (presumably one created with `make-car-comparator`),
and replaces it with new-pair; or if there is no such pair, adjoins
new-pair to the set.  It's tailor-made for your application.

--
John Cowan          http://www.ccil.org/~cowan        xxxxxx@ccil.org
What has four pairs of pants, lives in Philadelphia,
and it never rains but it pours?
        --Rufus T. Firefly