aboutsummaryrefslogtreecommitdiff
path: root/python/core.py
diff options
context:
space:
mode:
authorJoel Martin <github@martintribe.org>2014-04-09 23:58:27 -0500
committerJoel Martin <github@martintribe.org>2014-04-09 23:58:27 -0500
commita34b02006527d28db5df5c6553be804770b81f79 (patch)
tree526fe400e5a8c34b32a3d93439197db09c7f84ad /python/core.py
parentedc3b0640f1b773e185550448e2086279f7b1a7f (diff)
downloadmal-a34b02006527d28db5df5c6553be804770b81f79.tar.gz
mal-a34b02006527d28db5df5c6553be804770b81f79.zip
Fix metadata on functions.
- Don't use metadata to store ast, env, params data. - In Clojure, store metadata on the :meta key of the real metadata. This also allows using any datatype as metadata.
Diffstat (limited to 'python/core.py')
-rw-r--r--python/core.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/python/core.py b/python/core.py
index 28d9c5e..5e2ef75 100644
--- a/python/core.py
+++ b/python/core.py
@@ -85,7 +85,10 @@ def mapf(f, lst): return List(map(f, lst))
# Metadata functions
def with_meta(obj, meta):
- new_obj = copy.copy(obj)
+ if type(obj) == type(lambda x:x):
+ new_obj = obj.__copy__()
+ else:
+ new_obj = copy.copy(obj)
new_obj.__meta__ = meta
return new_obj