Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Io fixes #425

Merged
merged 4 commits into from
Jul 21, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions io/MalTypes.io
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,28 @@ MalMeta := Object clone do(

MalSymbol := Object clone appendProto(MalMeta) do (
val ::= nil
with := method(str, self clone setVal(str))
with := method(str, self clone setVal(if(str ?val, str val, str)))
malPrint := method(readable, val)
== := method(other, (self type == other type) and (val == other val))
)

MalKeyword := Object clone do (
val ::= nil
with := method(str, self clone setVal(str))
with := method(str, self clone setVal(if(str ?val, str val, str)))
malPrint := method(readable, ":" .. val)
== := method(other, (self type == other type) and (val == other val))
)

MalSequential := Object clone do(
isSequential := method(true)
equalSequence := method(other,
if((other ?isSequential) not, return false)
if(self size != other size, return false)
unequalElement := self detect(i, valA,
(valA == (other at(i))) not
)
if(unequalElement, false, true)
)
)

MalList := List clone appendProto(MalSequential) appendProto(MalMeta) do (
Expand All @@ -39,6 +47,7 @@ MalList := List clone appendProto(MalSequential) appendProto(MalMeta) do (
)
rest := method(MalList with(resend))
slice := method(MalList with(resend))
== := method(other, equalSequence(other))
)

MalVector := List clone appendProto(MalSequential) appendProto(MalMeta) do (
Expand All @@ -48,6 +57,7 @@ MalVector := List clone appendProto(MalSequential) appendProto(MalMeta) do (
)
rest := method(MalList with(resend))
slice := method(MalList with(resend))
== := method(other, equalSequence(other))
)

MalMap := Map clone appendProto(MalMeta) do (
Expand Down Expand Up @@ -109,7 +119,7 @@ MalFunc := Object clone appendProto(MalMeta) do (
call := method(args, blk call(args))
)

MalAtom := Object clone do (
MalAtom := Object clone appendProto(MalMeta) do (
val ::= nil
with := method(str, self clone setVal(str))
malPrint := method(readable, "(atom " .. (val malPrint(true)) .. ")")
Expand Down
2 changes: 1 addition & 1 deletion io/step8_macros.io
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ EVAL := method(ast, env,
ast = quasiquote(ast at(1))
continue, // TCO
"defmacro!",
return(env set(ast at(1), EVAL(ast at(2), env) setIsMacro(true))),
return(env set(ast at(1), EVAL(ast at(2), env) clone setIsMacro(true))),
"macroexpand",
return(macroexpand(ast at(1), env))
)
Expand Down
2 changes: 1 addition & 1 deletion io/step9_try.io
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ EVAL := method(ast, env,
ast = quasiquote(ast at(1))
continue, // TCO
"defmacro!",
return(env set(ast at(1), EVAL(ast at(2), env) setIsMacro(true))),
return(env set(ast at(1), EVAL(ast at(2), env) clone setIsMacro(true))),
"macroexpand",
return(macroexpand(ast at(1), env)),
"try*",
Expand Down
2 changes: 1 addition & 1 deletion io/stepA_mal.io
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ EVAL := method(ast, env,
ast = quasiquote(ast at(1))
continue, // TCO
"defmacro!",
return(env set(ast at(1), EVAL(ast at(2), env) setIsMacro(true))),
return(env set(ast at(1), EVAL(ast at(2), env) clone setIsMacro(true))),
"macroexpand",
return(macroexpand(ast at(1), env)),
"try*",
Expand Down