This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-03-12
Channels
- # beginners (4)
- # boot (58)
- # braid-chat (9)
- # cider (19)
- # clojure (26)
- # clojure-austin (8)
- # clojure-berlin (1)
- # clojure-poland (2)
- # clojure-russia (238)
- # clojurescript (22)
- # core-async (2)
- # cursive (6)
- # datomic (32)
- # emacs (5)
- # hoplon (1)
- # jobs (10)
- # keechma (1)
- # ldnclj (2)
- # off-topic (5)
- # om (7)
- # onyx (4)
- # proton (1)
- # re-frame (10)
- # reagent (5)
- # ring-swagger (10)
Let c
be a channel and suppose that L
is the list '(>! c 5)
. Is it possible in clojurescript to do something like (apply go L)
so that the end result is a channel c
with the value 5
shoved into it? I know that you cannot literally say (apply go L)
since go
is a macro and therefore cannot be used with apply
. Moreover, I know that clojurescript doesn't have eval
so you cannot just say (eval (conj L 'go))
.
So is there a way to achieve this effect without the usage of apply
and eval
?
I read somewhere that partial
is slow in clojurescript and I am wondering in which way and if a curried function is better, but maybe I am just worrying too much
I see from the source that partial
is basically creating a fn
with 5 arities
any thought on this?
@richiardiandrea: try benchmarking it!
(sorry, i don't know the answer - i've been profiling/benchmarking my cljs app all day, so that's where my mind is)
@jrheard is there an equivalent to criterium for ClojureScript? Sorry I haven't even googled yet :)
hi guys I have this kind of errors while using cljsbuild to build production javascript :
ERROR: JSC_MISSING_PROVIDE_ERROR. required "my_project.projects.project_page" namespace never provided at /Volumes/Data/dev/cljs-housing/resources/public/js/production/aaa/components/app.js line 9 : 0
ERROR: JSC_MISSING_PROVIDE_ERROR. required "my_project.utils.browser_settings" namespace never provided at /Volumes/Data/dev/cljs-housing/resources/public/js/production/aaa/core.js line 4 : 0
ERROR: JSC_MISSING_PROVIDE_ERROR. required "my_project.utils.browser_settings" namespace never provided at /Volumes/Data/dev/cljs-aaa/resources/public/js/production/my_project/landing/page.js line 5 : 0
I don't know what kind of this error is, since I'm pretty sure that the namespace is there ( it works in dev )@george.w.singer: I’m afraid it is not possible. go
generates code during compilation phase (yeah that’s the definition of a macro). You cannot feed it with dynamic L
and expect it to generate code at runtime (without using eval
). Not sure about your use-case, but if you are able to generate L
during compilation phase you could write a macro which would apply go to "L-expanded-at-compile-time".
Something along these lines where gen-body
is another macro, which looks at L
during compilation and generates body forms from it somehow, e.g. using some naming conventions or using some compile-time tables etc.:
(defmacro apply-go[body-spec]
(let [body (gen-body body-spec)]
`(go ~@body)))
Basically you would need to move all logic related to body construction from L to macros.looking for a react thing that helps with inline autocompletion like @nick and #channel in Slack — any one a recommendation?
So this does appear to work, but it's pretty gross. Is there a Location or URI method I'm missing, to get the full URL before the pathname in a single step?
(defn- token
"Generate a 'token' compatible with goog.history.Html5History. Basically a full URL."
[path]
(let [location (.-location js/window)
base (str (.-protocol location) "//" (.-host location))]
(str base path)))
(defroute home "/admin" []
(.setToken @history (token "/admin"))
(re-frame/dispatch [:display-home])) ; the re-frame stuff works fine
I need the full URL, because otherwise it tries to set the history state to
—evidently there are no relative states.(I'm also open to a better way of adding a history state and setting window.location
! The history
atom in this code is an instance of goog.history.Html5History
.)
@martinklepsch: What's your opinion of the various Google results for "react autocomplete"? You might be able to integrate one of those JS projects into your code.
@amacdougall: not sure about your use case, but it sounds like you could use Accountant.
Good recommendation, @pez. My code more or less does the same thing, but probably worse. I'll check out the Accountant source and see what I can learn from it.
@amacdougall: most of them are for input fields and don't seem to be suitable for textareas/token-triggred autocompletion
Ah, I see what you mean. I don't know—it might not be that hard to implement. You just have to handle the token by starting your autocomplete routine. I know that saying "you just have to" is usually a preface to something deceptively difficult...
@pez: I tried just throwing Accountant into my code, and it worked right off the bat. Great stuff, thanks!
@amacdougall: I agree. It just does the right thing. CC: @venantius