#define REPL_BUFFER_MAX 1024
-static struct EvalResult f(Gc *gc, struct Scope *scope, struct Expr args)
+static struct EvalResult quit(void *param, Gc *gc, struct Scope *scope, struct Expr args)
{
assert(scope);
(void) args;
+ (void) param;
- printf("Hello from C!\n");
+ exit(0);
return eval_success(NIL(gc));
}
Gc *gc = create_gc();
struct Scope scope = {
- .expr = NIL(gc)
+ .expr = CONS(gc, NIL(gc), NIL(gc))
};
- set_scope_value(gc, &scope, SYMBOL(gc, "f"), NATIVE(gc, f));
+ set_scope_value(gc, &scope, SYMBOL(gc, "quit"), NATIVE(gc, quit, NULL));
while (true) {
printf("> ");