// single list.
internal readonly int max_args;
+ public delegate Term Builtin (Domain domain, Variable vari, Term[] terms);
+
public Function () { }
public Function (Symbol name, bool with_var, int min_args, int max_args)
internal class Subroutine : Function
{
- public Func<Domain, Variable, Term[], Term> builtin;
+ public Builtin builtin;
- public Subroutine (Func<Domain, Variable, Term[], Term> builtin,
- Symbol name, bool with_var,
+ public Subroutine (Builtin builtin, Symbol name, bool with_var,
int min_args, int max_args)
: base (name, with_var, min_args, max_args)
{
internal class SpecialForm : Function
{
- public Func<Domain, Variable, Term[], Term> builtin;
+ public Builtin builtin;
- public SpecialForm (Func<Domain, Variable, Term[], Term> builtin,
- Symbol name, bool with_var,
+ public SpecialForm (Builtin builtin, Symbol name, bool with_var,
int min_args, int max_args)
: base (name, with_var, min_args, max_args)
{
}
}
- public void DefSubr (Func<Domain, Variable, Term[], Term> builtin,
- Symbol name, bool with_var,
- int min_args, int max_args)
+ public void DefSubr (Function.Builtin builtin, Symbol name,
+ bool with_var, int min_args, int max_args)
{
check_func_head (name, with_var, min_args, max_args, false);
functions[name] = new Function.Subroutine (builtin, name, with_var,
min_args, max_args);
}
- public void DefSpecial (Func<Domain, Variable, Term[], Term> builtin,
- Symbol name, bool with_var,
- int min_args, int max_args)
+ public void DefSpecial (Function.Builtin builtin, Symbol name,
+ bool with_var, int min_args, int max_args)
{
check_func_head (name, with_var, min_args, max_args, false);
functions[name] = new Function.SpecialForm (builtin, name, with_var,
private static bool default_stop (XmlNode n) { return n == null; }
- public static Term[] Parse (Domain domain, XmlNode node,
- Func<XmlNode, bool> stop)
+ public delegate bool ParseStop (XmlNode node);
+
+ public static Term[] Parse (Domain domain, XmlNode node, ParseStop stop)
{
if (stop == null)
stop = default_stop;