Exemplo n.º 1
0
 public SwitchD(G.IEnumerable <Case <X, Y> > Cases, Func <X, Y> @default)
 {
     this.Cases   = Lst.make(Cases);
     this.Default = @default;
 }
Exemplo n.º 2
0
 public Lst <EnumChoice <E> > Execute(EnumChoice <E> s0)
 => Lst.make(_Execute(s0));
Exemplo n.º 3
0
 /// <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));
Exemplo n.º 4
0
 /// <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));
Exemplo n.º 5
0
 /// <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);
Exemplo n.º 6
0
 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);
Exemplo n.º 7
0
 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));
Exemplo n.º 8
0
 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));