|
|
|
@@ -164,14 +164,12 @@ proc apply_arguments_to_function(Lisp_Object* arguments, Function* function) -> |
|
|
|
proc read_rest_arg = [&]() -> void { |
|
|
|
if (arguments == Memory::nil) { |
|
|
|
if (function->rest_argument) { |
|
|
|
try_void sym = Memory::get_or_create_lisp_object_symbol(function->rest_argument); |
|
|
|
define_symbol(sym, Memory::nil); |
|
|
|
define_symbol(function->rest_argument, Memory::nil); |
|
|
|
} |
|
|
|
} else { |
|
|
|
if (function->rest_argument) { |
|
|
|
try_void sym = Memory::get_or_create_lisp_object_symbol(function->rest_argument); |
|
|
|
define_symbol( |
|
|
|
sym, |
|
|
|
function->rest_argument, |
|
|
|
// NOTE(Felix): arguments will be a list, and I THINK |
|
|
|
// we do not need to copy it... |
|
|
|
arguments); |
|
|
|
@@ -334,7 +332,7 @@ proc parse_argument_list(Lisp_Object* arguments, Function* function) -> void { |
|
|
|
create_parsing_error("After the 'rest' marker there must follow a symbol."); |
|
|
|
return; |
|
|
|
} |
|
|
|
function->rest_argument = arguments->value.pair.first->value.symbol.identifier; |
|
|
|
function->rest_argument = arguments->value.pair.first; |
|
|
|
if (arguments->value.pair.rest != Memory::nil) { |
|
|
|
create_parsing_error("The lambda list must end after the rest symbol"); |
|
|
|
} |
|
|
|
@@ -483,6 +481,7 @@ proc eval_expr(Lisp_Object* node) -> Lisp_Object* { |
|
|
|
create_generic_error("%s is not a function.", Lisp_Object_Type_to_string(Memory::get_type(node))); |
|
|
|
return nullptr; |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@@ -557,6 +556,5 @@ proc interprete_stdin() -> void { |
|
|
|
print(evaluated); |
|
|
|
printf("\n"); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |