Re: [Haskell-cafe] Re: Bi-directional Maps

2007-09-02 Thread Hugh Perkins
Just noticed, erlang has the second kind of bimap (a bijection?) built into each process: From http://www.erlang.org/doc/reference_manual/processes.html : 10.9 Process Dictionary Each process has its own process dictionary, accessed by calling the following BIFs: put(Key, Value) get(Key) get()

Re: [Haskell-cafe] Re: Bi-directional Maps

2007-08-21 Thread Hugh Perkins
Exactly. For this to work there needs to be the constraint that there's a one-to-one mapping in each direction. The Bimap should have the uniqueness promise that Set (k, v) gives. Yet you should be able to search on either tuple value. Or... have the possibility of returning a list of values.

Re: [Haskell-cafe] Re: Bi-directional Maps

2007-08-21 Thread Albert Y. C. Lai
apfelmus wrote: Hugh Perkins wrote: Arguably there are two possible implementations, one that enforces one-to-one mapping, and one which allows multiple values, in either direction. Terminology reminder :) - the latter is called (binary) relation http://en.wikipedia.org/wiki/Binary_relation

Re: [Haskell-cafe] Re: Bi-directional Maps

2007-08-20 Thread Rich Neswold
On 8/20/07, apfelmus [EMAIL PROTECTED] wrote: Andrew Wagner wrote: It occurred to me that it would be useful to explicitly have a Bi-directional Map, which does the maintenance of keeping the Maps synchronized behind the scenes. Thus, Bimap was born! ... most of the map functions