mirror of
https://github.com/kanaka/mal.git
synced 2024-11-10 02:45:44 +03:00
Only print header info in REPL mode
This commit is contained in:
parent
bb52697591
commit
230dc1aa8d
@ -6,12 +6,10 @@ defmodule Mix.Tasks.Step6File do
|
||||
env = Mal.Env.new()
|
||||
Mal.Env.merge(env, Mal.Core.namespace)
|
||||
bootstrap(args, env)
|
||||
load_file(args, env)
|
||||
loop(env)
|
||||
end
|
||||
|
||||
defp load_file([], _env), do: nil
|
||||
defp load_file([file_name | _args], env) do
|
||||
defp load_file(file_name, env) do
|
||||
read_eval_print("""
|
||||
(load-file "#{file_name}")
|
||||
""", env)
|
||||
@ -37,8 +35,12 @@ defmodule Mix.Tasks.Step6File do
|
||||
end})
|
||||
|
||||
case args do
|
||||
[_file_name | rest] -> Mal.Env.set(env, "*ARGV*", list(rest))
|
||||
[] -> Mal.Env.set(env, "*ARGV*", list([]))
|
||||
[file_name | rest] ->
|
||||
Mal.Env.set(env, "*ARGV*", list(rest))
|
||||
load_file(file_name, env)
|
||||
|
||||
[] ->
|
||||
Mal.Env.set(env, "*ARGV*", list([]))
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -6,12 +6,10 @@ defmodule Mix.Tasks.Step7Quote do
|
||||
env = Mal.Env.new()
|
||||
Mal.Env.merge(env, Mal.Core.namespace)
|
||||
bootstrap(args, env)
|
||||
load_file(args, env)
|
||||
loop(env)
|
||||
end
|
||||
|
||||
defp load_file([], _env), do: nil
|
||||
defp load_file([file_name | _args], env) do
|
||||
defp load_file(file_name, env) do
|
||||
read_eval_print("""
|
||||
(load-file "#{file_name}")
|
||||
""", env)
|
||||
@ -37,8 +35,12 @@ defmodule Mix.Tasks.Step7Quote do
|
||||
end})
|
||||
|
||||
case args do
|
||||
[_file_name | rest] -> Mal.Env.set(env, "*ARGV*", list(rest))
|
||||
[] -> Mal.Env.set(env, "*ARGV*", list([]))
|
||||
[file_name | rest] ->
|
||||
Mal.Env.set(env, "*ARGV*", list(rest))
|
||||
load_file(file_name, env)
|
||||
|
||||
[] ->
|
||||
Mal.Env.set(env, "*ARGV*", list([]))
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -6,12 +6,10 @@ defmodule Mix.Tasks.Step8Macros do
|
||||
env = Mal.Env.new()
|
||||
Mal.Env.merge(env, Mal.Core.namespace)
|
||||
bootstrap(args, env)
|
||||
load_file(args, env)
|
||||
loop(env)
|
||||
end
|
||||
|
||||
defp load_file([], _env), do: nil
|
||||
defp load_file([file_name | _args], env) do
|
||||
defp load_file(file_name, env) do
|
||||
read_eval_print("""
|
||||
(load-file "#{file_name}")
|
||||
""", env)
|
||||
@ -60,8 +58,12 @@ defmodule Mix.Tasks.Step8Macros do
|
||||
end})
|
||||
|
||||
case args do
|
||||
[_file_name | rest] -> Mal.Env.set(env, "*ARGV*", list(rest))
|
||||
[] -> Mal.Env.set(env, "*ARGV*", list([]))
|
||||
[file_name | rest] ->
|
||||
Mal.Env.set(env, "*ARGV*", list(rest))
|
||||
load_file(file_name, env)
|
||||
|
||||
[] ->
|
||||
Mal.Env.set(env, "*ARGV*", list([]))
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -6,12 +6,10 @@ defmodule Mix.Tasks.Step9Try do
|
||||
env = Mal.Env.new()
|
||||
Mal.Env.merge(env, Mal.Core.namespace)
|
||||
bootstrap(args, env)
|
||||
load_file(args, env)
|
||||
loop(env)
|
||||
end
|
||||
|
||||
defp load_file([], _env), do: nil
|
||||
defp load_file([file_name | _args], env) do
|
||||
defp load_file(file_name, env) do
|
||||
read_eval_print("""
|
||||
(load-file "#{file_name}")
|
||||
""", env)
|
||||
@ -60,8 +58,12 @@ defmodule Mix.Tasks.Step9Try do
|
||||
end})
|
||||
|
||||
case args do
|
||||
[_file_name | rest] -> Mal.Env.set(env, "*ARGV*", list(rest))
|
||||
[] -> Mal.Env.set(env, "*ARGV*", list([]))
|
||||
[file_name | rest] ->
|
||||
Mal.Env.set(env, "*ARGV*", list(rest))
|
||||
load_file(file_name, env)
|
||||
|
||||
[] ->
|
||||
Mal.Env.set(env, "*ARGV*", list([]))
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -6,12 +6,10 @@ defmodule Mix.Tasks.StepAMal do
|
||||
env = Mal.Env.new()
|
||||
Mal.Env.merge(env, Mal.Core.namespace)
|
||||
bootstrap(args, env)
|
||||
load_file(args, env)
|
||||
loop(env)
|
||||
end
|
||||
|
||||
defp load_file([], _env), do: nil
|
||||
defp load_file([file_name | _args], env) do
|
||||
defp load_file(file_name, env) do
|
||||
read_eval_print("""
|
||||
(load-file "#{file_name}")
|
||||
""", env)
|
||||
@ -58,15 +56,18 @@ defmodule Mix.Tasks.StepAMal do
|
||||
`(let* (or_FIXME ~(first xs)) (if or_FIXME or_FIXME (or ~@(rest xs))))))))
|
||||
""", env)
|
||||
|
||||
read_eval_print("(println (str \"Mal [\" *host-language* \"]\"))", env)
|
||||
|
||||
Mal.Env.set(env, "eval", %Function{value: fn [ast] ->
|
||||
eval(ast, env)
|
||||
end})
|
||||
|
||||
case args do
|
||||
[_file_name | rest] -> Mal.Env.set(env, "*ARGV*", list(rest))
|
||||
[] -> Mal.Env.set(env, "*ARGV*", list([]))
|
||||
[file_name | rest] ->
|
||||
Mal.Env.set(env, "*ARGV*", list(rest))
|
||||
load_file(file_name, env)
|
||||
|
||||
[] ->
|
||||
Mal.Env.set(env, "*ARGV*", list([]))
|
||||
read_eval_print("(println (str \"Mal [\" *host-language* \"]\"))", env)
|
||||
end
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user