Re: [containers-users] Request for comments on BiMap

2018-02-27 Thread SP

Made progress with enriching the module's interface and done some
basic testing.

https://github.com/c-cube/ocaml-containers/compare/master...orbifx:bimap

It's missing sequence conversions, which I need to read about before I
can implement them.

Anything else?

--
   SP
___
Containers-users mailing list
Containers-users@lists.ocaml.org
http://lists.ocaml.org/listinfo/containers-users


Re: [containers-users] Request for comments on BiMap

2018-02-24 Thread Simon Cruanes
Le Sat, 24 Feb 2018, Drup wrote:
> Why not call this "Bijection" or "BijMap" ? BiMap simply implies two maps.
> This a bit more specific.

It makes sense! `Bijection` is about the intent, `BiMap` ties to an
implementation. However if we change the name we still have to convey
that it's a functional bijection (rather than imperative).


-- 
Simon Cruanes

http://weusepgp.info/
key 49AA62B6, fingerprint 949F EB87 8F06 59C6 D7D3  7D8D 4AC0 1D08 49AA 62B6


signature.asc
Description: PGP signature
___
Containers-users mailing list
Containers-users@lists.ocaml.org
http://lists.ocaml.org/listinfo/containers-users


Re: [containers-users] Request for comments on BiMap

2018-02-24 Thread Drup
Why not call this "Bijection" or "BijMap" ? BiMap simply implies two 
maps. This a bit more specific.



Le 23/02/2018 à 01:37, SP a écrit :

I've started working on a BiMap, a map where (key, value) is also
(value, key) in a one-to-one relationship.

https://github.com/c-cube/ocaml-containers/compare/master...orbifx:bimap

As I'm writing this I have written `empty`, `add`, `find_left` and
`find_right`.

The idea is that when adding a left-key, right-value to the BiMap, it
doesn't just check for the preexistence of the left key, but also checks
if the right value already has a left key and removes it if so. Vice
versa for right key, left value.

Please provide any comments and thoughts.

One question I have is why are map values first in the order of
parameters? For example:

https://github.com/c-cube/ocaml-containers/blob/master/src/data/CCMultiMap.ml#L294 






___
Containers-users mailing list
Containers-users@lists.ocaml.org
http://lists.ocaml.org/listinfo/containers-users


Re: [containers-users] Request for comments on BiMap

2018-02-23 Thread Simon Cruanes



>Shall I revert the order for this module, or has the "new convention"
>have to be upheld?

Put the map last, as is convenient for piping. 

-- 
Simon 

___
Containers-users mailing list
Containers-users@lists.ocaml.org
http://lists.ocaml.org/listinfo/containers-users


[containers-users] Request for comments on BiMap

2018-02-22 Thread SP

I've started working on a BiMap, a map where (key, value) is also
(value, key) in a one-to-one relationship.

https://github.com/c-cube/ocaml-containers/compare/master...orbifx:bimap

As I'm writing this I have written `empty`, `add`, `find_left` and
`find_right`.

The idea is that when adding a left-key, right-value to the BiMap, it
doesn't just check for the preexistence of the left key, but also checks
if the right value already has a left key and removes it if so. Vice
versa for right key, left value.

Please provide any comments and thoughts.

One question I have is why are map values first in the order of
parameters? For example:

https://github.com/c-cube/ocaml-containers/blob/master/src/data/CCMultiMap.ml#L294

--
SP
___
Containers-users mailing list
Containers-users@lists.ocaml.org
http://lists.ocaml.org/listinfo/containers-users