This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-07-27
Channels
- # admin-announcements (1)
- # aws-lambda (2)
- # beginners (48)
- # boot (231)
- # capetown (1)
- # cider (35)
- # cljs-dev (25)
- # cljsrn (74)
- # clojure (273)
- # clojure-austin (2)
- # clojure-berlin (5)
- # clojure-hk (1)
- # clojure-poland (1)
- # clojure-russia (50)
- # clojure-spec (63)
- # clojure-uk (58)
- # clojurescript (51)
- # cursive (5)
- # datomic (39)
- # defnpodcast (3)
- # dirac (13)
- # editors (6)
- # emacs (3)
- # hoplon (86)
- # jobs (2)
- # lein-figwheel (1)
- # liberator (3)
- # off-topic (10)
- # om (113)
- # onyx (34)
- # protorepl (29)
- # re-frame (2)
- # reagent (8)
- # remote-jobs (1)
- # ring (4)
- # test-check (42)
- # untangled (31)
- # yada (2)
With cljs and core.async if I have (go (<! my-ch))
, can I consume the value from that channel outside of a go block?
@twashing: no, it is not possible, you can covert go channels back to callbacks/promises/etc. and pass around those, if more suitable
how do you usually splice items into hiccup/reagent vectors? E.g.
[:ul [:li "foo"] (if smth? [:li "bar"] MAGIC_NEEDED_HERE: [[:li "baz] [:li "baq"]] )]
this particular example won't work because vectors have a special meaning; I can create a seq, but suddenly keys and doall will be needed, so it's less than ideal
@si14: (into [:ul [:li "foo"]] (if smth? [[:li "bar"]] [[:li "baz] [:li "baq"]] )])
@martinklepsch: right, thanks!
any examples on cljs.clojure/js-transforms
? I just found it for the :preprocess
option on the cljs compiler for :foreign-libs
it seems new.
(defmacro spec-cmds
"Convenient shorthand for descibing specs of the form of an s/or
combination of tuples, each beginning with a unique first keyword and then
followed by a variable number of arguments. (spec-cmds [cmd1 arg11 arg12]
[cmd2 arg21]) matches tuples of the form [cmd1 arg11 arg12] or [cmd2 arg21]."
[& cmds]
(let [or-spec (mapcat
(fn [[cmd-name & arg-specs]]
(assert (keyword? cmd-name)
(str "spec-cmds expected a keyword cmd name, saw " cmd-name))
[cmd-name `(cljs.spec/tuple #{~cmd-name} ~@arg-specs)])
cmds)]
`(cljs.spec/or ~@or-spec)))
If I try to write it for clojure, and do something like #?(:clj (:require [clojure.spec :as s]) :cljs (:require [cljs.spec :as s]))
then it’ll include the wrong symbol in cljs
which is about the same as using a conditional at call site, but perhaps a little less burdensome
hey all, this is perhaps a stupid question, but what is the standard way to package cljs code as a library such that multiple projects can use it as a lein coordinate?
i dont necessarily even need it to be a distinct coordinate, just need two different projects in the same git tree to share a little code
fwiw, i am using lein/cljsbuild…I suppose I could just adjust the cljsbuild->builds->source-paths
@tel: Here's an example https://github.com/tonsky/rum/blob/gh-pages/src/rum/core.clj#L85 . It seems you can use the &env
special param like (boolean (:ns &env))
which will be true for cljs and false for clj
@ghaskins: very much the same as for clojure
@ghaskins: you put a bunch of cljs files in a jar, put the jar on clojars, done 🙂
@martinklepsch: ah, so simple, should have thought of that
@tel: FWIW, the problem will eventually go away in a nice way. See http://blog.fikesfarm.com/posts/2016-07-03-clojurescript-clojure-namespace-aliasing.html