This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-08-29
Channels
- # aws (1)
- # beginners (78)
- # boot (27)
- # cider (16)
- # clara (15)
- # cljs-dev (84)
- # cljsjs (13)
- # cljsrn (19)
- # clojure (65)
- # clojure-france (10)
- # clojure-italy (8)
- # clojure-russia (35)
- # clojure-spec (34)
- # clojure-uk (124)
- # clojurescript (50)
- # clojutre (3)
- # core-async (16)
- # data-science (18)
- # datascript (1)
- # datomic (9)
- # emacs (2)
- # flambo (3)
- # fulcro (55)
- # graphql (3)
- # hoplon (4)
- # jobs (2)
- # juxt (21)
- # keechma (6)
- # lumo (73)
- # off-topic (4)
- # om (10)
- # onyx (5)
- # parinfer (1)
- # pedestal (3)
- # re-frame (60)
- # reagent (19)
- # specter (24)
@dominicm thanks - got it to work:
{
mach/constant {msg "World"}
hello (println (str "Hello " #ref [mach/constant msg]))
}
# $ mach hello
# => Hello World
# $ mach --constant '{msg "Mars"}'
# => Hello Mars
@dominicm coming back to our earlier conversation of pondering making this kind of thing nicer: ((js/require "request") "
, one might imagine a literal to assist (#js ...)
so many node libraries require one of these forms:
(def r (js/require "request"))
(def r ((js/require "request")))
(def r (.request (js/require "request")))
Making one pretty & not the others in a consistent way is confusing to use.{mach/npm [["left-pad" "1.1.3"]]
pad-foo (println ((js/require "left-pad") "foo" 5))}
but it occurs you could also mess with the mach/npm directive, to add a symbol there you want to def
the lib to
Hmm, also a case fraught with peril given e.g. require('material-components-web/dist/material-components-web')
is a part of the material-components-web
module.
we currently have this to tidy up also:
{mach/npm [["left-pad" "1.1.3"]]
mach/init (def lp (js/require "left-pad"))
pad-foo (println (lp "foo" 5))}
That syntax obviously works quite consistently. Not opposed to something like:
mach/constants {lp (js/require "left-pad")}
pad-foo (println (lp "foo" 5))
Anything that can create a body of bindings for you.