Would this trait:

    pub trait Map<K: Copy Eq Ord, V: Copy> {
      pure fn get(k: K) -> @Option<V>;
      pure fn put(k: K, v: V) -> self;
      pure fn delete(k: K) -> self;
      pure fn traverse(f: fn((&K), (@Option<V>)));
    }

be something that ought to live somewhere in the standard library?

I also see that you have an impl of this trait in which you also define a
bunch of methods that don't belong to the trait. I didn't even know that
was possible! If you feel that those methods (blacken, modifiedWith,
balance, modWith) don't belong in the Map trait, perhaps split their
definitions off into a separate "anonymous" impl for now, and then when 0.5
rolls around you can define a trait that inherits from the Map trait and
requires those additional methods.


On Fri, Dec 14, 2012 at 6:51 PM, Steve Jenson <[email protected]> wrote:

> I recently ported Matt Might's Scala port of Okasaki's purely functional
> red-black tree to Rust and am looking for some feedback.
>
> https://github.com/stevej/rustled/blob/master/red_black_tree.rs
>
> I've written this for 0.4 and will update it with other feedback I've
> received for 0.5 when that lands.
>
> Thanks!
> Steve
>
>
> _______________________________________________
> Rust-dev mailing list
> [email protected]
> https://mail.mozilla.org/listinfo/rust-dev
>
>
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to