|
|
|
@@ -102,7 +102,7 @@ proc load_built_ins_into_environment() -> void { |
|
|
|
|
|
|
|
|
|
|
|
#define fetch1(var) \ |
|
|
|
static Lisp_Object* var##_symbol = Memory::get_or_create_lisp_object_symbol(#var); \ |
|
|
|
Lisp_Object* var##_symbol = Memory::get_or_create_lisp_object_symbol(#var); \ |
|
|
|
Lisp_Object* var = lookup_symbol(var##_symbol, get_current_environment()); \ |
|
|
|
if (Globals::error) printf("in %s:%d\n", __FILE__, __LINE__) |
|
|
|
|
|
|
|
@@ -167,7 +167,7 @@ proc load_built_ins_into_environment() -> void { |
|
|
|
); \ |
|
|
|
assert_type(label(params,__LINE__), Lisp_Object_Type::Pair); \ |
|
|
|
assert_type(label(params,__LINE__)->value.pair.first, Lisp_Object_Type::Symbol); \ |
|
|
|
static auto label(sym,__LINE__) = label(params,__LINE__)->value.pair.first; \ |
|
|
|
auto label(sym,__LINE__) = label(params,__LINE__)->value.pair.first; \ |
|
|
|
auto label(sfun,__LINE__) = Memory::create_lisp_object_cfunction(special); \ |
|
|
|
/*NOTE(Felix): for evaluating default args*/ \ |
|
|
|
/*push_environment(get_root_environment());*/ \ |
|
|
|
@@ -586,14 +586,14 @@ proc load_built_ins_into_environment() -> void { |
|
|
|
}; |
|
|
|
define_special((quasiquote expr), "TODO") { |
|
|
|
fetch(expr); |
|
|
|
static auto unquote_sym = Memory::get_or_create_lisp_object_symbol("unquote"); |
|
|
|
static auto unquote_splicing_sym = Memory::get_or_create_lisp_object_symbol("unquote-splicing"); |
|
|
|
Lisp_Object* unquote_sym = Memory::get_or_create_lisp_object_symbol("unquote"); |
|
|
|
Lisp_Object* unquote_splicing_sym = Memory::get_or_create_lisp_object_symbol("unquote-splicing"); |
|
|
|
/* recursive lambdas in lambdas yay!! */ |
|
|
|
// NOTE(Felix): first we have to initialize the variable |
|
|
|
// with a garbage lambda, so that we can then overwrite it |
|
|
|
// a recursive lambda |
|
|
|
std::function<Lisp_Object*(Lisp_Object*)> unquoteSomeExpressions; // = [] (Lisp_Object* expr) -> Lisp_Object* {return nullptr;}; |
|
|
|
unquoteSomeExpressions = [&unquoteSomeExpressions] (Lisp_Object* expr) -> Lisp_Object* { |
|
|
|
unquoteSomeExpressions = [&] (Lisp_Object* expr) -> Lisp_Object* { |
|
|
|
// if it is an atom, return it |
|
|
|
if (Memory::get_type(expr) != Lisp_Object_Type::Pair) |
|
|
|
return Memory::copy_lisp_object(expr); |
|
|
|
|