|
|
|
@@ -51,13 +51,6 @@ proc load_built_ins_into_environment(Environment* env) -> void { |
|
|
|
Lisp_Object* evaluated_arguments; |
|
|
|
|
|
|
|
#define cLambda [=](Lisp_Object* arguments, Environment* env) mutable -> Lisp_Object* |
|
|
|
#define report_error(_type) { \ |
|
|
|
if (log_level == Log_Level::Debug) { \ |
|
|
|
printf("Error occurred\nin %s:%d\n", __FILE__, __LINE__); \ |
|
|
|
} \ |
|
|
|
create_error(_type, current_source_code_location); \ |
|
|
|
return nullptr; \ |
|
|
|
} |
|
|
|
|
|
|
|
proc defun = [&](const char* name, auto fun) { |
|
|
|
define_symbol( |
|
|
|
@@ -347,41 +340,6 @@ proc load_built_ins_into_environment(Environment* env) -> void { |
|
|
|
|
|
|
|
return value; |
|
|
|
}); |
|
|
|
// defun("define-upwards", cLambda { |
|
|
|
// try { |
|
|
|
// arguments_length = list_length(arguments); |
|
|
|
// } |
|
|
|
|
|
|
|
// if (arguments_length != 2) { |
|
|
|
// report_error(Error_Type::Wrong_Number_Of_Arguments); |
|
|
|
// } |
|
|
|
|
|
|
|
// Lisp_Object* symbol = arguments->value.pair.first; |
|
|
|
|
|
|
|
// if (symbol->type == Lisp_Object_Type::Pair) { |
|
|
|
// try { |
|
|
|
// symbol = eval_expr(symbol, env); |
|
|
|
// } |
|
|
|
// } |
|
|
|
|
|
|
|
// if (symbol->type != Lisp_Object_Type::Symbol) { |
|
|
|
// report_error(Error_Type::Type_Missmatch); |
|
|
|
// } |
|
|
|
|
|
|
|
// if (!env->parent) { |
|
|
|
// report_error(Error_Type::Unknown_Error); |
|
|
|
// } |
|
|
|
|
|
|
|
|
|
|
|
// Lisp_Object* value = arguments->value.pair.rest->value.pair.first; |
|
|
|
// try { |
|
|
|
// value = eval_expr(value, env); |
|
|
|
// } |
|
|
|
|
|
|
|
// define_symbol(symbol, value, env->parent); |
|
|
|
|
|
|
|
// return value; |
|
|
|
// }); |
|
|
|
defun("mutate", cLambda { |
|
|
|
try evaluated_arguments = eval_arguments(arguments, env, &arguments_length); |
|
|
|
try assert_arguments_length(2, arguments_length); |
|
|
|
@@ -969,6 +927,5 @@ proc load_built_ins_into_environment(Environment* env) -> void { |
|
|
|
return Memory::create_lisp_object_string(resulting_string); |
|
|
|
}); |
|
|
|
|
|
|
|
#undef report_error |
|
|
|
#undef cLambda |
|
|
|
} |