Exemplo n.º 1
0
 /// <summary>
 /// Uncertain parameters in any of the two function types will return false.
 /// Only fully defined fuction types can be compared with useful results.
 /// </summary>
 /// <param name="other"></param>
 /// <returns></returns>
 public bool MatchesType(FunctionType other)
 {
     foreach (var funcType in new[] { this, other })
     {
         if (funcType.InputSignature.Contains(ValueType.Uncertain)) return false;
         if (funcType.OutputSignature == ValueType.Uncertain) return false;
     }
     return InputSignature.MemberwiseEquals(other.InputSignature) && OutputSignature == other.OutputSignature;
 }
Exemplo n.º 2
0
 public Function(Fixity fixity, int numArguments)
     : base(ValueType.Function)
 {
     if (fixity > 0 && numArguments != 2) throw new Exception("This constructor can only be used for prefix functions");
     Signature = new FunctionType(fixity, numArguments);
     Kind = ValueKind.Function;
 }
Exemplo n.º 3
0
 public Function(Fixity fixity)
     : base(ValueType.Function)
 {
     if (fixity == 0) throw new Exception("This constructor can only be used for infix functions");
     Signature = new FunctionType(fixity);
     Kind = ValueKind.Function;
 }