File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- (defproject clojure-python " 0.1.0 "
1+ (defproject clojure-python " 0.1.1 "
22 :description " Improve seamlessness of Clojure Jython interop."
33 :dependencies [[org.clojure/clojure " 1.3.0" ]
44 [org.python/jython-standalone " 2.5.2" ]]
5- :dev-dependencies [[midje " 1.3.0-RC4 " ]]
5+ :dev-dependencies [[midje " 1.3.0" ]]
66 :main clojure-python.core )
Original file line number Diff line number Diff line change 3434 if multiple arguments are given, the first is assumed
3535 to be a library that has been imported,
3636 and the others are objects to import from this library"
37- ([] nil )
3837 ([lib] ; import a library
3938 `(do (.exec *interp* (str " import " ~(name lib)))
4039 (def ~lib
4140 (-> *interp*
4241 .getLocals
4342 (.__getitem__ ~(name lib))
44- .__dict__))
45- (print ~lib)))
46- ([lib object] ; import object from a library
47- `(do (def ~object (.__finditem__ ~lib ~(name object)))
48- (print ~object)))
49- ([lib object & more-objects] ; import multiple objects
50- `(do (py-import ~lib ~object)
51- (py-import ~lib ~@more-objects))))
43+ .__dict__)))
44+ (print ~lib))
45+ ([lib & objects] ; import object from a library
46+ (cons 'do
47+ (mapcat
48+ (fn [obj]
49+ `((def ~obj (.__finditem__ ~lib ~(name obj)))
50+ (print ~obj)))
51+ objects))))
5252
5353(defmacro import-fn
5454 " this is like import but it defines the imported item
You can’t perform that action at this time.
0 commit comments