This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2015-10-21
Channels
- # admin-announcements (42)
- # alda (1)
- # beginners (11)
- # boot (24)
- # boulder-clojurians (2)
- # cider (10)
- # cljs-dev (23)
- # clojure (63)
- # clojure-czech (4)
- # clojure-japan (2)
- # clojure-russia (44)
- # clojure-sg (2)
- # clojure-switzerland (2)
- # clojurescript (135)
- # community-development (5)
- # css (4)
- # cursive (19)
- # datomic (34)
- # emacs (2)
- # events (5)
- # funcool (13)
- # hoplon (3)
- # ldnclj (43)
- # ldnproclodo (1)
- # lein-figwheel (7)
- # luminus (7)
- # off-topic (54)
- # om (115)
- # onyx (82)
- # overtone (3)
- # re-frame (6)
- # reagent (15)
- # yada (5)
heyo, is there any existing sugar for (m/fapply (m/fmap curried+ (just 1)) (just 2) (just 3))
, i.e. being able to write (some-sugar curried+ (just 1) (just 2) (just 3))
?
essentially, idiom brackets from the original applicative paper
Would something like this do the trick?
(defmacro idiom
[f & as]
(let [args (map (fn [x] [(gensym) x]) as)]
`(m/alet [~@(apply concat args)]
(~f ~@(map first args)))))
yep, that looks reasonable. I was mainly wondering if there was such a thing hidden in the library already.
(defn ap [f arg & args]
(apply m/fapply (m/fmap f arg) args))
we can currently lift a function to a monadic context with lift-m
and we're working on a lift-a
version https://github.com/funcool/cats/pull/113
@blendmaster: the ap
combinator could be a great addition to cats
I like it semantically, but it could certainly use some syntax bikeshedding
See https://ocharles.org.uk/IdiomBrackets.html for haskell and https://github.com/aztek/scala-workflow for scala