KumiScript/interpreter/PrimitiveProcedure.cs

27 lines
692 B
C#
Raw Normal View History

2024-01-26 05:37:51 +00:00
namespace KumiScript.Interpreter
{
public class PrimitiveProcedure : Procedure
{
public delegate Expression PrimitiveDelegate(ListExpression args, Environment env);
readonly PrimitiveDelegate _function;
public PrimitiveProcedure(PrimitiveDelegate function)
{
_function = function;
}
public override Expression ApplyWithArgs(ListExpression args, Environment env)
{
return _function(args, env);
}
public override bool IsPrimitive()
{
return true;
}
public override string ToString()
{
return _function.ToString();
}
}
}