mirror of
https://github.com/kanaka/mal.git
synced 2024-09-20 01:57:09 +03:00
julia: Pass function arguments as a mal list
This commit is contained in:
parent
cb737f83da
commit
f98e3ea939
@ -51,7 +51,7 @@ function EVAL(ast, env)
|
|||||||
EVAL(ast[3], env)
|
EVAL(ast[3], env)
|
||||||
end
|
end
|
||||||
elseif symbol("fn*") == ast[1]
|
elseif symbol("fn*") == ast[1]
|
||||||
(args...) -> EVAL(ast[3], Env(env, ast[2], args))
|
(args...) -> EVAL(ast[3], Env(env, ast[2], Any[args...]))
|
||||||
else
|
else
|
||||||
el = eval_ast(ast, env)
|
el = eval_ast(ast, env)
|
||||||
f, args = el[1], el[2:end]
|
f, args = el[1], el[2:end]
|
||||||
|
@ -61,7 +61,7 @@ function EVAL(ast, env)
|
|||||||
end
|
end
|
||||||
elseif symbol("fn*") == ast[1]
|
elseif symbol("fn*") == ast[1]
|
||||||
return MalFunc(
|
return MalFunc(
|
||||||
(args...) -> EVAL(ast[3], Env(env, ast[2], args)),
|
(args...) -> EVAL(ast[3], Env(env, ast[2], Any[args...])),
|
||||||
ast[3], env, ast[2])
|
ast[3], env, ast[2])
|
||||||
else
|
else
|
||||||
el = eval_ast(ast, env)
|
el = eval_ast(ast, env)
|
||||||
|
@ -61,7 +61,7 @@ function EVAL(ast, env)
|
|||||||
end
|
end
|
||||||
elseif symbol("fn*") == ast[1]
|
elseif symbol("fn*") == ast[1]
|
||||||
return MalFunc(
|
return MalFunc(
|
||||||
(args...) -> EVAL(ast[3], Env(env, ast[2], args)),
|
(args...) -> EVAL(ast[3], Env(env, ast[2], Any[args...])),
|
||||||
ast[3], env, ast[2])
|
ast[3], env, ast[2])
|
||||||
else
|
else
|
||||||
el = eval_ast(ast, env)
|
el = eval_ast(ast, env)
|
||||||
|
@ -82,7 +82,7 @@ function EVAL(ast, env)
|
|||||||
end
|
end
|
||||||
elseif symbol("fn*") == ast[1]
|
elseif symbol("fn*") == ast[1]
|
||||||
return MalFunc(
|
return MalFunc(
|
||||||
(args...) -> EVAL(ast[3], Env(env, ast[2], args)),
|
(args...) -> EVAL(ast[3], Env(env, ast[2], Any[args...])),
|
||||||
ast[3], env, ast[2])
|
ast[3], env, ast[2])
|
||||||
else
|
else
|
||||||
el = eval_ast(ast, env)
|
el = eval_ast(ast, env)
|
||||||
|
@ -107,7 +107,7 @@ function EVAL(ast, env)
|
|||||||
end
|
end
|
||||||
elseif symbol("fn*") == ast[1]
|
elseif symbol("fn*") == ast[1]
|
||||||
return MalFunc(
|
return MalFunc(
|
||||||
(args...) -> EVAL(ast[3], Env(env, ast[2], args)),
|
(args...) -> EVAL(ast[3], Env(env, ast[2], Any[args...])),
|
||||||
ast[3], env, ast[2])
|
ast[3], env, ast[2])
|
||||||
else
|
else
|
||||||
el = eval_ast(ast, env)
|
el = eval_ast(ast, env)
|
||||||
|
@ -125,7 +125,7 @@ function EVAL(ast, env)
|
|||||||
end
|
end
|
||||||
elseif symbol("fn*") == ast[1]
|
elseif symbol("fn*") == ast[1]
|
||||||
return MalFunc(
|
return MalFunc(
|
||||||
(args...) -> EVAL(ast[3], Env(env, ast[2], args)),
|
(args...) -> EVAL(ast[3], Env(env, ast[2], Any[args...])),
|
||||||
ast[3], env, ast[2])
|
ast[3], env, ast[2])
|
||||||
else
|
else
|
||||||
el = eval_ast(ast, env)
|
el = eval_ast(ast, env)
|
||||||
|
@ -125,7 +125,7 @@ function EVAL(ast, env)
|
|||||||
end
|
end
|
||||||
elseif symbol("fn*") == ast[1]
|
elseif symbol("fn*") == ast[1]
|
||||||
return MalFunc(
|
return MalFunc(
|
||||||
(args...) -> EVAL(ast[3], Env(env, ast[2], args)),
|
(args...) -> EVAL(ast[3], Env(env, ast[2], Any[args...])),
|
||||||
ast[3], env, ast[2])
|
ast[3], env, ast[2])
|
||||||
else
|
else
|
||||||
el = eval_ast(ast, env)
|
el = eval_ast(ast, env)
|
||||||
|
Loading…
Reference in New Issue
Block a user