Пример #1
0
    public static HMap <A, HMap <B, HMap <C, HMap <D, T> > > > Remove <A, B, C, D, T>(this HMap <A, HMap <B, HMap <C, HMap <D, T> > > > self, A aKey, B bKey, C cKey, D dKey)
    {
        var res = self.Find(aKey, bKey, cKey);

        if (res.IsSome && res.CountT() > 1)
        {
            return(self.SetItemT(aKey, bKey, cKey, res.Lift().Remove(dKey)));
        }
        else
        {
            if (res.IsSome)
            {
                if (res.MapT(d => d.ContainsKey(dKey)).Lift())
                {
                    return(Remove(self, aKey, bKey, cKey));
                }
                else
                {
                    return(self);
                }
            }
            else
            {
                return(Remove(self, aKey, bKey, cKey));
            }
        }
    }