コード例 #1
0
        public static ImList <T> Create(IEnumerable <T> values)
        {
            var        valuesArray = values.ToArray();
            ImList <T> list        = Nil;

            for (int i = valuesArray.Length - 1; i >= 0; i--)
            {
                list = new ConsList(valuesArray[i], list);
            }
            return(list);
        }
コード例 #2
0
 public ConsList(T headUnsafe, ImList <T> tailUnsafe)
 {
     HeadUnsafe = headUnsafe;
     TailUnsafe = tailUnsafe;
 }
コード例 #3
0
 public static ImList <T> Cons(T head, ImList <T> tail) => new ConsList(head, tail);