I'm trying to run the with-deocorator example from hy manual (https://docs.hylang.org/en/stable/language/api.html?highlight=with-decorator#with-decorator):
(defn inc-decorator [func]
(fn [value-1 value-2] (func (+ value-1 1) (+ value-2 1))))
(with-decorator inc-decorator (defn addition [a b] (+ a b)))
(setv foo (addition 1 1))
(print foo)
but I'm getting an exception:
line 4, in <module>
(with-decorator inc-decorator (defn addition [a b] (+ a b)))
NameError: name 'with_decorator' is not defined
with_decorator with underscore. I'm trying with the latest stable version of hy. The same thing happens with any code that has with-decorator.
with-decorator
was recently removed in master, whereas it still existed in 0.20.0, so I think you're mistaken. Checkhy --version
.