HCoop
/
jackhill
/
mal.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
| inline |
side by side
crystal: refactor by adding Array to Mal type conversion
[jackhill/mal.git]
/
crystal
/
types.cr
diff --git
a/crystal/types.cr
b/crystal/types.cr
index
6f68ed0
..
5620330
100644
(file)
--- a/
crystal/types.cr
+++ b/
crystal/types.cr
@@
-83,3
+83,10
@@
end
macro gen_type(t, *args)
Mal::Type.new {{t.id}}.new({{*args}})
end
+
+class Array
+ def to_mal(t = Mal::List)
+ each_with_object(t.new){|e, l| l << e}
+ end
+end
+