You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm quite new to clojure and not sure if there isn't a better way already, but I found myself writing things like
(fn [x] (->> x (f a) (g b)))
quite often. Which I instinctively want to write in a point-free style, but this means I'll loose the comfort and readability of arrows:
(comp (partial g b) (partial f a))
I'm using these trivial helper macros now:
(defmacrofn->"(fn-> f g...) expands to (fn [x] (-> x f g...)"
[& args]
`(fn [x#] (-> x# ~@args)))
(defmacrofn->>"(fn->> f g...) expands to (fn [x] (->> x f g...))"
[& args]
`(fn [x#] (->> x# ~@args)))
which allow writing
(fn->> (f a) (g b))
Would that be a candidate for inclusion in swiss-arrows?
The text was updated successfully, but these errors were encountered:
I don't understand how this would work using cond->? It accepts a value as the first argument like all the other arrows, my idea was about introducing a higher-order arrow that returns a function, which when given a value returns the same result as the other arrows do when given that value as the first argument.
Edit (confused cond-> and condp. There wouldn't be a useful fncond-> version because the clauses would have no way to access the value)
I'm quite new to clojure and not sure if there isn't a better way already, but I found myself writing things like
quite often. Which I instinctively want to write in a point-free style, but this means I'll loose the comfort and readability of arrows:
I'm using these trivial helper macros now:
which allow writing
Would that be a candidate for inclusion in swiss-arrows?
The text was updated successfully, but these errors were encountered: