1
1
mirror of https://github.com/kanaka/mal.git synced 2024-09-11 13:55:55 +03:00

clean up comments

This commit is contained in:
AnotherTest 2020-01-12 15:09:52 +03:30
parent 989b1e6e00
commit 597522fa1d
9 changed files with 16 additions and 51 deletions

View File

@ -482,4 +482,4 @@ def core_interp(arguments; env):
else
[ $orig.value[], $stuff[] ] | wrap("vector")
end
) // jqmal_error("Unknown native function \(.function)");
) // jqmal_error("Unknown native function \(.function)");

View File

@ -13,26 +13,6 @@ def read_line:
def READ:
read_str | read_form | .value;
# def eval_ast(env):
# (select(.kind == "symbol") | .value | env_get(env) | addEnv(env)) //
# (select(.kind == "list") | reduce .value[] as $elem (
# {value: [], env: env};
# . as $dot | $elem | EVAL($dot.env) as $eval_env |
# {
# value: ($dot.value + [$eval_env.expr]),
# env: $eval_env.env
# }
# ) | { expr: .value, env: .env }) // (addEnv(env));
# def patch_with_env(env):
# . as $dot | (reduce .[] as $fnv (
# [];
# . + [$fnv | setpath([1, "free_referencess"]; ($fnv[1].free_referencess + $dot) | unique)]
# )) as $functions | reduce $functions[] as $function (
# env;
# env_set(.; $function[0]; $function[1])
# ) | { functions: $functions, env: . };
def recurseflip(x; y):
recurse(y; x);
@ -116,7 +96,7 @@ def EVAL(env):
binds: $binds,
env: env,
body: $value[2],
names: [], # we can't do that circular reference this
names: [], # we can't do that circular reference thing
free_referencess: $value[2] | find_free_references(env | env_dump_keys + $binds) # for dynamically scoped variables
} | addEnv(env)
) //
@ -217,4 +197,4 @@ def repl(env):
repl(
"(def! not (fn* (a) (if a false true)))" | rep(replEnv) | .env
)
)

View File

@ -100,15 +100,13 @@ def EVAL(env):
) //
(
.value | select(.[0].value == "fn*") as $value |
# we can't do what the guide says, so we'll skip over this
# and ues the later implementation
# (fn* args body)
$value[1].value | map(.value) as $binds | {
kind: "function",
binds: $binds,
env: $_menv,
body: $value[2],
names: [], # we can't do that circular reference this
names: [], # we can't do that circular reference thing
free_referencess: $value[2] | find_free_references($_menv | env_dump_keys + $binds) # for dynamically scoped variables
} | TCOWrap($_menv; $_orig_retenv; false)
) //
@ -215,4 +213,4 @@ def repl(env):
repl(
"(def! not (fn* (a) (if a false true)))" | rep(replEnv) | .env
)
)

View File

@ -110,8 +110,6 @@ def EVAL(env):
) //
(
.value | select(.[0].value == "fn*") as $value |
# we can't do what the guide says, so we'll skip over this
# and ues the later implementation
# (fn* args body)
$value[1].value | map(.value) as $binds |
($value[2] | find_free_references($currentEnv | env_dump_keys + $binds)) as $free_referencess | {
@ -119,7 +117,7 @@ def EVAL(env):
binds: $binds,
env: (env | env_remove_references($free_referencess)),
body: $value[2],
names: [], # we can't do that circular reference this
names: [], # we can't do that circular reference thing
free_referencess: $free_referencess # for dynamically scoped variables
} | TCOWrap($_menv; $_orig_retenv; false)
) //
@ -252,4 +250,4 @@ def main:
repl( getEnv as $env | env_set_($env; "*ARGV*"; [] | wrap("list")) )
end;
[ main ] | _halt
[ main ] | _halt

View File

@ -144,8 +144,6 @@ def EVAL(env):
) //
(
.value | select(.[0].value == "fn*") as $value |
# we can't do what the guide says, so we'll skip over this
# and ues the later implementation
# (fn* args body)
$value[1].value | map(.value) as $binds |
($value[2] | find_free_references($currentEnv | env_dump_keys + $binds)) as $free_referencess | {
@ -153,7 +151,7 @@ def EVAL(env):
binds: $binds,
env: (env | env_remove_references($free_referencess)),
body: $value[2],
names: [], # we can't do that circular reference this
names: [], # we can't do that circular reference thing
free_referencess: $free_referencess # for dynamically scoped variables
} | TCOWrap($_menv; $_orig_retenv; false)
) //
@ -295,5 +293,3 @@ def main:
end;
[ main ] | _halt
# ( ( (fn* (a) (fn* (b) (+ a b))) 5) 7)

View File

@ -236,8 +236,6 @@ def EVAL(env):
) //
(
.value | select(.[0].value == "fn*") as $value |
# we can't do what the guide says, so we'll skip over this
# and ues the later implementation
# (fn* args body)
$value[1].value | map(.value) as $binds |
($value[2] | find_free_references($currentEnv | env_dump_keys + $binds)) as $free_referencess | {
@ -245,7 +243,7 @@ def EVAL(env):
binds: $binds,
env: (env | env_remove_references($free_referencess)),
body: $value[2],
names: [], # we can't do that circular reference this
names: [], # we can't do that circular reference thing
free_referencess: $free_referencess, # for dynamically scoped variables
is_macro: false
} | TCOWrap($_menv; $_orig_retenv; false)
@ -362,4 +360,4 @@ def main:
repl( getEnv as $env | env_set_($env; "*ARGV*"; [] | wrap("list")) )
end;
[ main ] | _halt
[ main ] | _halt

View File

@ -265,8 +265,6 @@ def EVAL(env):
) //
(
.value | select(.[0].value == "fn*") as $value |
# we can't do what the guide says, so we'll skip over this
# and ues the later implementation
# (fn* args body)
$value[1].value | map(.value) as $binds |
($value[2] | find_free_references($currentEnv | env_dump_keys + $binds)) as $free_referencess | {
@ -274,7 +272,7 @@ def EVAL(env):
binds: $binds,
env: (env | env_remove_references($free_referencess)),
body: $value[2],
names: [], # we can't do that circular reference this
names: [], # we can't do that circular reference thing
free_referencess: $free_referencess, # for dynamically scoped variables
is_macro: false
} | TCOWrap($_menv; $_orig_retenv; false)
@ -391,4 +389,4 @@ def main:
repl( getEnv as $env | env_set_($env; "*ARGV*"; [] | wrap("list")) )
end;
[ main ] | _halt
[ main ] | _halt

View File

@ -271,8 +271,6 @@ def EVAL(env):
) //
(
.value | select(.[0].value == "fn*") as $value |
# we can't do what the guide says, so we'll skip over this
# and ues the later implementation
# (fn* args body)
$value[1].value | map(.value) as $binds |
($value[2] | find_free_references($currentEnv | env_dump_keys + $binds)) as $free_referencess | {
@ -280,7 +278,7 @@ def EVAL(env):
binds: $binds,
env: $_menv,
body: $value[2],
names: [], # we can't do that circular reference this
names: [], # we can't do that circular reference thing
free_referencess: $free_referencess, # for dynamically scoped variables
is_macro: false
} | TCOWrap($_menv; $_orig_retenv; false)
@ -403,4 +401,4 @@ def main:
repl( getEnv as $env | env_set_($env; "*ARGV*"; [] | wrap("list")) )
end;
[ main ] | _halt
[ main ] | _halt

View File

@ -114,11 +114,10 @@ def _extern(options):
input | fromjson
else
null
end; # oof
end;
def issue_extern(cmd; options):
{cmd: cmd, args: .}
# | (tostring | debug) as $ignore
| _extern(options);
def issue_extern(cmd):
@ -158,4 +157,4 @@ def _halt:
| halt;
def trap:
_write_to_file("trap_reason.json") | jqmal_error("trap");
_write_to_file("trap_reason.json") | jqmal_error("trap");