File tree Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Original file line number Diff line number Diff line change 52
52
53
53
(defmacro defn-dynj
54
54
" Declares `name` as a dynamic injection point, to be bound to an
55
- implementation/value later via [[binding]], and adds a default
56
- implementation. Typically you would throw a helpful exception in the
57
- body."
55
+ implementation/value later via [[binding]], and adds a default implementation.
56
+ Typically you would throw a helpful exception in `body`."
58
57
[name params & body]
59
58
(let [[docstring params body]
60
59
(if (string? params)
61
60
[params (first body) (rest body)]
62
61
[nil params body])]
63
62
64
- `(do (defn ~name [~@params] ~body )
63
+ `(do (defn ~name [~@params] ~@ body )
65
64
(alter-meta! (var ~name) assoc
66
65
:dynamic true
67
66
::dynj true
Original file line number Diff line number Diff line change 25
25
(sut/bound-fn* (fn [v]
26
26
(foo v))))]
27
27
(t/is (= 8 (f 4 )))))
28
+
29
+ (sut/defn-dynj bar [arg]
30
+ (* 3 arg))
31
+
32
+ (t/deftest defn-dynj-default-implementation-test
33
+ (t/is (= 9 (bar 3 ))))
You can’t perform that action at this time.
0 commit comments