Пример #1
0
 public IfDotted() : base("if_then_else_dotted", true,
                          new[]
 {
     Curry.ConstructFrom(a,
                         new Curry(b, Typs.Bool),
                         new Curry(b, a),
                         b),
     Curry.ConstructFrom(a,
                         new Curry(b, Typs.String),
                         new Curry(b, a),
                         b),
     Curry.ConstructFrom(a,
                         new Curry(b, Typs.Bool),
                         new Curry(b, a),
                         new Curry(b, a),
                         b),
     Curry.ConstructFrom(a,
                         new Curry(b, Typs.String),
                         new Curry(b, a),
                         new Curry(b, a),
                         b)
 }
                          )
 {
     Funcs.AddBuiltin(this, "ifdotted");
     Funcs.AddBuiltin(this, "ifDotted");
 }
Пример #2
0
 public Const() : base("firstArg", true,
                       new[]
 {
     Curry.ConstructFrom(new Var("a"), new Var("a"), new Var("b"))
 }
                       )
 {
     Funcs.AddBuiltin(this, "const");
 }
Пример #3
0
 public NotEq() : base("notEq", true,
                       new[]
 {
     Curry.ConstructFrom(Typs.Bool, new Var("a"), new Var("a")),
     Curry.ConstructFrom(Typs.String, new Var("a"), new Var("a")),
     new Curry(Typs.Bool, Typs.Bool),
 })
 {
     Funcs.AddBuiltin(this, "not");
 }
Пример #4
0
        protected Function(string name, bool isBuiltin, IEnumerable <Curry> types)
        {
            Name = name;
            if (isBuiltin)
            {
                Funcs.AddBuiltin(this);
            }

            Types = types;
        }
Пример #5
0
 public If() : base("if_then_else", true,
                    new[]
 {
     Curry.ConstructFrom(a, Typs.Bool, a, a),
     Curry.ConstructFrom(a, Typs.Bool, a),
     Curry.ConstructFrom(a, Typs.String, a, a),
     Curry.ConstructFrom(a, Typs.String, a)
 }
                    )
 {
     Funcs.AddBuiltin(this, "if");
 }
Пример #6
0
 public Min() : base("min", true,
                     new[]
 {
     new Curry(new ListType(Typs.Nat), Typs.Nat),
     new Curry(new ListType(Typs.Int), Typs.Int),
     new Curry(new ListType(Typs.PDouble), Typs.PDouble),
     new Curry(new ListType(Typs.Double), Typs.Double),
     new Curry(new ListType(Typs.Bool), Typs.Bool),
 })
 {
     Funcs.AddBuiltin(this, "and");
 }
Пример #7
0
 public MustMatch() : base("must_match", true,
                           new[] {
     // [String] -> (Tags -> [string]) -> Tags -> bool
     Curry.ConstructFrom(Typs.Bool,                                       // Result type on top!
                         new ListType(Typs.String),                       // List of keys to check for
                         new Curry(Typs.Tags, new ListType(Typs.String)), // The function to execute on every key
                         Typs.Tags                                        // The tags to apply this on
                         )
 })
 {
     Funcs.AddBuiltin(this, "mustMatch");
 }
Пример #8
0
 public Sum() : base("sum", true,
                     new[]
 {
     new Curry(new ListType(Typs.Nat), Typs.Nat),
     new Curry(new ListType(Typs.Int), Typs.Int),
     new Curry(new ListType(Typs.PDouble), Typs.PDouble),
     new Curry(new ListType(Typs.Double), Typs.Double),
     new Curry(new ListType(Typs.Bool), Typs.Int),
 })
 {
     Funcs.AddBuiltin(this, "plus");
     Funcs.AddBuiltin(this, "add");
 }
Пример #9
0
 public FirstMatchOf() : base("first_match_of", true,
                              new[]
 {
     // [String] -> (Tags -> [a]) -> Tags -> a
     Curry.ConstructFrom(new Var("a"),     // Result type on top!
                         new ListType(Typs.String),
                         new Curry(Typs.Tags, new ListType(new Var("a"))),
                         Typs.Tags
                         )
 })
 {
     Funcs.AddBuiltin(this, "firstMatchOf");
 }