lisp-take-1/value/user_lambda/new.c
Zander Thannhauser 44fb99b663 .
- macros work in the new way (the "right" way?)
- added test.py script, with basic test cases. Need to fill out new test
  builtins.
2024-12-02 19:33:23 -06:00

78 lines
1.3 KiB
C

#include <debug.h>
#include "../struct.h"
#include "../new.h"
#include "../kind.h"
#include "struct.h"
#include "inheritance.h"
#include "new.h"
struct value* new_user_lambda_value(
struct gc* gc,
struct value* environment,
struct value* parameters,
struct value* body)
{
ENTER;
struct value* super = new_value(
/* garbage collector/allocator: */ gc,
/* kind: */ vk_user_lambda,
/* inheritance: */ &user_lambda_value_inheritance);
struct user_lambda_value* this = &super->subclass.user_lambda;
this->environment = environment;
this->parameters = parameters;
this->body = body;
this->is_macro = false;
EXIT;
return super;
}
struct value* new_user_lambda_value_given_macro(
struct gc* gc,
struct value* environment,
struct value* parameters,
struct value* body,
bool is_macro)
{
ENTER;
struct value* super = new_value(
/* garbage collector/allocator: */ gc,
/* kind: */ vk_user_lambda,
/* inheritance: */ &user_lambda_value_inheritance);
struct user_lambda_value* this = &super->subclass.user_lambda;
this->environment = environment;
this->parameters = parameters;
this->body = body;
this->is_macro = is_macro;
EXIT;
return super;
}