27 lines
No EOL
684 B
C#
27 lines
No EOL
684 B
C#
namespace KumiScript.Interpreter
|
|
{
|
|
public class PrimitiveProcedure : Procedure
|
|
{
|
|
public delegate Expression PrimitiveDelegate(Expression args, Environment env);
|
|
readonly PrimitiveDelegate _function;
|
|
public PrimitiveProcedure(PrimitiveDelegate function)
|
|
{
|
|
_function = function;
|
|
}
|
|
|
|
public override Expression ApplyWithArgs(Expression args, Environment env)
|
|
{
|
|
return _function(args, env);
|
|
}
|
|
|
|
public override bool IsPrimitive()
|
|
{
|
|
return true;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
return _function.ToString();
|
|
}
|
|
}
|
|
} |