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)); } }
public static Seq <A> SeqOne <A>(A value) => value.IsNull() ? Empty : LSeq.FromSingleValue(value);
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);
public static Seq <A> Cons <A>(this A head, SeqEmpty empty) => LSeq.FromSingleValue(head);