library Set {
    struct Data { mapping(uint => bool) flags; }

    function insert(Data storage self, uint value)
        public
        returns (bool)
    {
        if (self.flags[value])
            return false; // already there
        self.flags[value] = true;
        return true;
    }
}
// ----
