PreviousUpNext

Red-Black Trees: Filter

We might want to drop all key-value pairs failing some boolean test on the value:

    linux$ my

    eval:  include package   string_map;

    eval:  m = empty: Map( Int );

    eval:  m $= ("Key1", 1);
    eval:  m $= ("Key2", 2);
    eval:  m $= ("Key3", 3);

    eval:  m = filter  (\\ i = (i != 2))  m;

    eval:  keyvals_list m;
    [("Key1", 1), ("Key3", 3)]

We might want to fetch the value of a key which might not be present:


Comments and suggestions to: bugs@mythryl.org

PreviousUpNext