public SwitchD(G.IEnumerable <Case <X, Y> > Cases, Func <X, Y> @default) { this.Cases = Lst.make(Cases); this.Default = @default; }
public Lst <EnumChoice <E> > Execute(EnumChoice <E> s0) => Lst.make(_Execute(s0));
/// <summary> /// Parses a list representation /// </summary> /// <typeparam name="X">The item type</typeparam> /// <param name="formatted">The formatted list</param> /// <returns></returns> public static Lst <X> parse <X>(string formatted) => Lst.make(from list in formatted.GetBoundedContent('[', ']') from item in list.Split(",") select metacore.parse <X>(item));
/// <summary> /// Reads all lines of text from the file /// </summary> /// <returns></returns> public static Lst <string> ReadAllLines(this IFilePath path, Encoding encoding) => path.IsUnspecified() ? list <string>() : Lst.make(File.ReadAllLines(path.FileSystemPath, encoding));
/// <summary> /// Creates a list from a stream /// </summary> /// <typeparam name="X">The item type</typeparam> /// <param name="source">The source stream</param> /// <returns></returns> public static Lst <X> AsList <X>(this IEnumerable <X> source) => Lst.make(source);
public static Lst <X> Where <X>(this Lst <X> list, Func <X, bool> predicate) => Lst.make(from x in list.Stream() where predicate(x) select x);
public static Lst <Z> SelectMany <X, Y, Z>(this Lst <X> list, Func <X, Lst <Y> > lift, Func <X, Y, Z> project) => Lst.make(from x in list.Stream() from y in lift(x).Stream() select project(x, y));
public static Lst <Y> Select <X, Y>(this Lst <X> list, Func <X, Y> selector) => Lst.make(from x in list.Stream() select selector(x));