Main+Env: Add more native functions

This commit is contained in:
Riyyi
2023-04-07 23:38:41 +02:00
parent 3d5a2e3fbe
commit 22920cb810
2 changed files with 59 additions and 0 deletions
+6
View File
@@ -53,6 +53,10 @@ auto read(std::string_view input) -> ASTNodePtr
auto eval(ASTNodePtr ast, EnvironmentPtr env) -> ASTNodePtr
{
if (env == nullptr) {
env = s_outer_env;
}
Eval eval(ast, env);
eval.eval();
@@ -76,6 +80,8 @@ static auto rep(std::string_view input, EnvironmentPtr env) -> std::string
static std::string_view lambdaTable[] = {
"(def! not (fn* (cond) (if cond false true)))",
"(def! load-file (fn* (filename) \
(eval (read-string (str \"(do \" (slurp filename) \"\nnil)\")))))",
};
static auto installLambdas(EnvironmentPtr env) -> void