// If only we could "consume" the lists somehow... ;)
        // We can work around this with immutability at least
        public static SortedBy <int, Comp> GdpSortBy <Comp>(List <int> list, Named <Comparison <int>, Comp> comp)
        {
            List <int> listCopy = list.Select(item => item).ToList();

            listCopy.Sort(comp.GetVal());
            return(new SortedBy <int, Comp>(listCopy));
        }
Exemple #2
0
 public static Proof <Equals <Length <Xs>, Succ <Succ <Zero> > > > LengthIsTwo <Xs>(Named <int, Length <Xs> > len)
 {
     if (len.GetVal() == 2)
     {
         return(Proof <Equals <Length <Xs>, Succ <Succ <Zero> > > > .Axiom());
     }
     return(null);
 }
 public static List <int> GdpMergeBy <Comp>(SortedBy <int, Comp> l1, SortedBy <int, Comp> l2, Named <Comparison <int>, Comp> comp)
 {
     return(MergeBy(l1.GetList(), l2.GetList(), comp.GetVal()));
 }
Exemple #4
0
 public static Named <int, Length <Xs> > Len <Xs>(Named <List <int>, Xs> xs)
 {
     return(Named <int, Length <Xs> > .Defn(xs.GetVal().Count, new Length <Xs>()));
 }