ЯК

Size: a a a
ЯК
D
AC
a
OR
CD
CD
(rf/reg-event-fx ;; register an event handler
:buy ;; for events with this name
(fn [cofx [_ item-id]] ;; get the co-effects and destructure the event
{:http-xhrio {:uri (str "http://url.com/product/" item-id "/purchase")
:method :post
:timeout 10000
:response-format (ajax/json-response-format {:keywords? true})
:on-success [:added-cart]
:on-failure [:notified-error]}
:db (update-in (:db cofx) [:cart :items] conj {:item item-id})}))
Почему последний аргумент update-in не лямбда? Или у conj здесь частичное применение и данный вызов эту лямбду возвращает?DL
(rf/reg-event-fx ;; register an event handler
:buy ;; for events with this name
(fn [cofx [_ item-id]] ;; get the co-effects and destructure the event
{:http-xhrio {:uri (str "http://url.com/product/" item-id "/purchase")
:method :post
:timeout 10000
:response-format (ajax/json-response-format {:keywords? true})
:on-success [:added-cart]
:on-failure [:notified-error]}
:db (update-in (:db cofx) [:cart :items] conj {:item item-id})}))
Почему последний аргумент update-in не лямбда? Или у conj здесь частичное применение и данный вызов эту лямбду возвращает?(update-in m ks f & args)
T
(rf/reg-event-fx ;; register an event handler
:buy ;; for events with this name
(fn [cofx [_ item-id]] ;; get the co-effects and destructure the event
{:http-xhrio {:uri (str "http://url.com/product/" item-id "/purchase")
:method :post
:timeout 10000
:response-format (ajax/json-response-format {:keywords? true})
:on-success [:added-cart]
:on-failure [:notified-error]}
:db (update-in (:db cofx) [:cart :items] conj {:item item-id})}))
Почему последний аргумент update-in не лямбда? Или у conj здесь частичное применение и данный вызов эту лямбду возвращает?CD
(fn [target] conj target {:item item-id})
T
(fn [target] conj target {:item item-id})
T
CD
T
T
CD
T
CD
conj {:item item-id}
не вызывается на месте потому что в скобки не заключено, видимо