aboutsummaryrefslogtreecommitdiff
path: root/python/core.py
diff options
context:
space:
mode:
authorJoel Martin <github@martintribe.org>2014-04-16 22:42:17 -0500
committerJoel Martin <github@martintribe.org>2014-04-16 22:42:17 -0500
commita05f7822b10ed4cdd61ed8384299a003baf1c1c6 (patch)
tree28ec9e0efa0cb5c7f335579271c61a2f910680f9 /python/core.py
parentb3402a82d38d0d59b91b117005c6bef2748acf8b (diff)
downloadmal-a05f7822b10ed4cdd61ed8384299a003baf1c1c6.tar.gz
mal-a05f7822b10ed4cdd61ed8384299a003baf1c1c6.zip
Python: metadata on builtin funcs. Support python3.
Diffstat (limited to 'python/core.py')
-rw-r--r--python/core.py11
1 files changed, 4 insertions, 7 deletions
diff --git a/python/core.py b/python/core.py
index 8b01b69..20ac793 100644
--- a/python/core.py
+++ b/python/core.py
@@ -17,12 +17,12 @@ def do_str(*args):
return "".join(map(lambda exp: printer._pr_str(exp, False), args))
def prn(*args):
- print " ".join(map(lambda exp: printer._pr_str(exp, True), args))
+ print(" ".join(map(lambda exp: printer._pr_str(exp, True), args)))
return None
def println(*args):
line = " ".join(map(lambda exp: printer._pr_str(exp, False), args))
- print line.replace('\\n', '\n')
+ print(line.replace('\\n', '\n'))
return None
@@ -85,10 +85,7 @@ def mapf(f, lst): return List(map(f, lst))
# Metadata functions
def with_meta(obj, meta):
- if type(obj) == type(lambda x:x):
- new_obj = obj.__copy__()
- else:
- new_obj = copy.copy(obj)
+ new_obj = types._clone(obj)
new_obj.__meta__ = meta
return new_obj
@@ -126,7 +123,7 @@ ns = {
'+': lambda a,b: a+b,
'-': lambda a,b: a-b,
'*': lambda a,b: a*b,
- '/': lambda a,b: a/b,
+ '/': lambda a,b: int(a/b),
'list': types._list,
'list?': types._list_Q,