Commit | Line | Data |
---|---|---|
f382a612 JM |
1 | (import [types :as pytypes]) |
2 | ||
ef47406a JM |
3 | (defclass MalException [Exception] |
4 | (defn --init-- [self val] (setv self.val val))) | |
5 | ||
5b86f08c JM |
6 | (defclass Atom [] |
7 | (defn --init-- [self val] (setv self.val val))) | |
8 | ||
f382a612 JM |
9 | (defn clone [obj] |
10 | (if (= (type obj) pytypes.FunctionType) | |
11 | (pytypes.FunctionType obj.__code__ obj.__globals__ | |
12 | :name obj.__name__ | |
13 | :argdefs obj.__defaults__ | |
14 | :closure obj.__closure__) | |
15 | obj)) |