コード例 #1
0
 public static Seq <A> Cons <A>(this A head, A[] tail)
 {
     if (tail == null || tail.Length == 0)
     {
         return(LSeq.FromSingleValue(head));
     }
     else
     {
         var data = new A[tail.Length + 1];
         System.Array.Copy(tail, 0, data, 1, tail.Length);
         data[0] = head;
         return(LSeq.FromArray(data));
     }
 }
コード例 #2
0
 public static Seq <A> SeqOne <A>(A value) =>
 value.IsNull()
         ? Empty
         : LSeq.FromSingleValue(value);
コード例 #3
0
 public static Seq <A> Cons <A>(this A head, IEnumerable <A> tail) =>
 tail == null?LSeq.FromSingleValue(head)
     : tail is Seq <A> seq?head.Cons(seq)
         : new Seq <A>(tail).Cons(head);
コード例 #4
0
 public static Seq <A> Cons <A>(this A head, SeqEmpty empty) =>
 LSeq.FromSingleValue(head);