This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2015-09-01
Channels
- # admin-announcements (11)
- # announcements (1)
- # beginners (1)
- # boot (36)
- # cider (8)
- # cljs-dev (13)
- # clojure (65)
- # clojure-berlin (18)
- # clojure-russia (54)
- # clojurescript (137)
- # code-reviews (3)
- # datomic (30)
- # emacs (9)
- # events (13)
- # hoplon (36)
- # jobs (1)
- # ldnclj (4)
- # melbourne (15)
- # off-topic (2)
- # om (4)
- # re-frame (5)
- # reagent (25)
- # sydney (3)
- # testing (1)
noob question... why doesn't (-> 1 (fn [x] x)) work ? but (-> 1 foo) does work where (def foo (fn [x] x)
You could probably write your own macro to do that.. though yes, it is kind of strange that lambda's aren't accounted for in thread-first/last macros
@sonnyto: go look at the definition of ->
and all will make sense. Them special casing things would probably be bad imo
I’m getting a : No single method: _setup of interface: cljs.repl.IJavaScriptEnv found for function: -setup of protocol: IJavaScriptEnv, compiling:(cemerick/piggieback.clj:149:5)
when trying to use boot
is there a common solution to this?
@joelkuiper: make sure you use recent versions of clojurescript and boot-cljs-repl
@martinklepsch: [org.clojure/clojurescript "1.7.122" :scope "provided”]
[adzerk/boot-cljs "1.7.48-3" :scope "test”]
[adzerk/boot-cljs-repl "0.1.10-SNAPSHOT" :scope "test”]
these seem to be the most recent
@joelkuiper: then I think another dependency is pulling in the wrong version of piggieback, try boot show -d
how should one refer to goog.DEBUG
in code? something like (when js/goog.DEBUG ...)
?
@pandeiro: I’m not sure but maybe you could even omit the js/
?
goog
is loaded by default. I think this is similar to using things with fully qualified namespaces after they’ve been required somewhere else.
@martinklepsch: ah yes “bouncer” was the issue … which came with Luminus, thanks
@martinklepsch: yeah makes sense, good call... and it works
(not sure if this is to be considered “clean” but I think it would work)
@joelkuiper: thinking about it you should have gotten a warning about that — would you mind checking?
sure, this is all the output I got I think …
<< started HTTP Kit on http://localhost:3000 >>
Starting file watcher (CTRL-C to quit)...
clojure.lang.Compiler$CompilerException: java.lang.IllegalArgumentException: No single method: _setup of interface: cljs.repl.IJavaScriptEnv found for function: -setup of protocol: IJavaScriptEnv, compiling:(cemerick/piggieback.clj:149:5)
java.lang.IllegalArgumentException: No single method: _setup of interface: cljs.repl.IJavaScriptEnv found for function: -setup of protocol: IJavaScriptEnv
@rauh good q! will test
I've always used a type hint (when ^boolean goog.DEBUG ....
It certainly used to be required
Unless anything has happened in the last couple of months
@mikethompson: a re-frame question: when a handler needs to dispatch to another, but that second handler needs the state set by the return value of the first - how does re-frame deal with that scenario?
@mikethompson: @rauh type hints are still required. Wondering if that could be fixed by adding it to the var when using goog-define
(this way at least for custom defines it wouldn’t be necessary anymore)
https://github.com/clojure/clojurescript/blob/r1.7.48/src/main/clojure/cljs/core.cljc#L712
@pandeiro: the second handler won't be run until after the first finishes. So the 2nd handler will be able to access any state (assumidly in app-db
) that it needs when it is (later) run.
@mikethompson: dispatch
uses a setTimeout
or something to only execute on next tick?
events dispatched are queued
stupid question, but I’m trying to get cljs to work with boot … but it keeps complaining about ClojureScript could not load :main, did you forget to specify :asset-path?
this is the config I’m playing with now https://gist.github.com/joelkuiper/fe63fde980b7e786bfbd
@joelkuiper: let’s chat in #C053K90BR
cool!
any reason for using (.. js/window -location -hash)
instead of js/window.location.hash
?
"js/something is for accessing a js object, but you shouldnt nest dots after that, since it is not clojure compatible syntax and it was going to be removed.” from http://stackoverflow.com/questions/24239144/js-console-log-in-clojurescript — that’s a year ago though 😄
I remember seeing this discussed before and often use things like js/console.log
since then
@onetom: @martinklepsch: I don’t where people came to the conclusion it was going to removed
yeah me neither
Maybe add a comment there @dnolen?
dnolen: thanks. i like convenience
i will carry your words on this to my colleagues tomorrow.
is there an equivalent of the arguments
js variable in clojure?
f = function(){console.log(arguments)}
f(1, 2, 3)
prints [1, 2, 3]
which is a #js[]i was using (fn [& args] (clj->js args))
but that's a bit of an overkill to transform it back and forth between persistent data structures...
i was just trying to translate google analytics snippet and wanted to keep it as close to the original implementation as possible, so it's easier to keep it up-to-date when it changes...
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
where can i learn these things from, btw? where is it documented? i've learnt cljs primarily from your https://github.com/swannodette/lt-cljs-tutorial/blob/master/lt-cljs-tutorial.cljs
@onetom: accessing arguments
just isn’t idiomatic ClojureScript, there’s really no reason to do that.
this isn’t performance critical code either, and even if it was you wouldn’t want to use arguments
then either
When testing using figwheel, is there a way to clear the tests currently defined, other than refreshing the connected browser?
@bbss: that seems to be the most effective, surefire way. And its simple as well. You could undef your root testing namespace (set! js/example_tests nil)
and that will delete all your current tests. Never tried it though.
are there any examples of using re-frame with datascript instead of a simple map as the db state?
Can anyone help with this problem of params inside a POST disappearing? And less importantly a problem with response being a single semicolon. -> https://gist.github.com/not-much-io/764c5bb5b46c804b6a42
@not-much-io: are you running the the app with :dev set? if not, missing wrap-params may be a problem
@zoldar I already got it working with help from the clojure chatroom. I was running :dev but the problem was that cljs-ajax default format was :edn. Setting it to json and wrapping using https://github.com/ring-clojure/ring-json#wrap-json-params worked for me
weird - I just did lein new figwheel om-tut -- --om
and the project doesn't have any om stuff in it
I don't know much about lein but in looking at the source for the figwheel template it sure looks to me like the following should be aborting and spitting out an error, but it doesn't:
C:\Users\Patrick\code> lein new figwheel om-tut -- --foobar
Generating fresh 'lein new' figwheel project.
@meow: Weird, I just did the same command on a Windows machine and it brought om in and looks fine to me
C:\Users\Patrick\code> lein version
Leiningen 2.5.2 on Java 1.8.0_45 Java HotSpot(TM) Client VM
@meow: Running Windows 10 64 bit on
Leiningen 2.5.1 on Java 1.8.0_31 Java HotSpot(TM) 64-Bit Server VM
@shaun-mahood: weird
I also get the error message
C:\Dev\om-tut>lein new figwheel om-tut -- --foobar
Unrecognized option: --foobar . Should be one of --om --reagent
I get all the errors you don't, so I'm pretty sure it balances
Yeah, Windows is nothing but equally unfair
@shaun-mahood: what version of lein are you on?
I tried it about a year ago and it had a bunch of minor issues, but have run into only 1 or 2 since using it for real in the past 6 months. Usually it's related to file system stuff that was never really tested on Windows before I used it I think
Looks like 2.5.1, and I have a bit older Java than you do too
Ahh, that might be it then. I'll wait for you to get them fixed before upgrading
Or at least try it on a fresh VM before putting it on my normal work machine.
Yeah, they definitely touched lein new
in 2.5.2 https://github.com/technomancy/leiningen/blob/master/NEWS.md
I've gotten away from the habit of using lein templates other than figwheel and have never used the flags. I've found that building up my project.clj one thing at a time has given me a lot fewer long term problems. I ran into a lot of issues with chestnut initially that seemed pretty Windows specific.
@shaun-mahood: same here - I just happened to be checking out the Om tutorial and trying out the figwheel template
Oh cool - how are you liking devcards? Figwheel is one of my favourite things ever at this point and I'm really looking forward to getting some time to dive in to devcards too
I didn't really understand them until I just dove in and looked at the ones Bruce had created as examples and then it clicked
By dive in I mean I did a git clone and ran them on my machine and looked at the source for the example cards
It's funny, I was experimenting with creating a way crappier version of devcards when Bruce released it, trying to solve similar problems but in a way uglier and more cumbersome way.
I need to be able to have one or more canvas elements in my devcards so I'm looking at how best to support that using react/om
And I want to add eval and repl options to devcards, but I'd be happier if someone else did it.
Since I started using figwheel I haven't found the need for a repl very often. Out of curiosity, what are you trying to do in devcards that needs eval and a repl?
oh cool, that would be an awesome use for it
Have you seen the tutorials that have been on the LispCast site recently?
Oh they're pretty cool, check out the top 4 posts http://www.lispcast.com/
Might give you some ideas for your own tutorials
@pandeiro: re Re-frame + Datascript: https://github.com/Day8/re-frame/issues/36
Another unmentioned difference between cljs and clj: the class
function doesn't exist in cljs
At least it isn't mentioned here: https://github.com/clojure/clojurescript/wiki/Differences-from-Clojure
@shaun-mahood: I'm going to be working on adding turtle graphics support to cljs in devcards
I got a little sidetracked going down this rabbit hole: https://github.com/decomplect/ion/blob/master/src/ion/ergo/l_system.cljc
Oh man that is a pretty big rabbit hole
From "I need to draw some lines" to that is a pretty good jump
@shaun-mahood: I never had a chance to play with fractals so I figured now was a good time.
Yeah, I'm pretty sure that's gonna take up some of your time
Well, the l-system library is pretty much done, other than adding more grammars and playing with the flexibility it has.
It'll be interesting to see how it can be used. Maybe some fractal music videos!