This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2015-11-03
Channels
- # admin-announcements (7)
- # beginners (30)
- # boot (181)
- # cbus (1)
- # cider (55)
- # cljs-dev (8)
- # clojure (104)
- # clojure-dev (3)
- # clojure-japan (1)
- # clojure-russia (70)
- # clojurescript (139)
- # core-logic (4)
- # cursive (23)
- # datomic (25)
- # devcards (10)
- # events (11)
- # funcool (1)
- # hoplon (39)
- # jobs (10)
- # ldnclj (19)
- # lein-figwheel (21)
- # off-topic (4)
- # om (174)
- # onyx (46)
- # re-frame (25)
- # reagent (3)
- # yada (7)
@grav open layers is a closure library, you should be able to use it without externs
@martinklepsch: well it doesn’t work in advanced compilation.
@grav: how do you use it?
I refer to it as eg js/ol.style.Circle.
, and it changed my code to something along the lines of new
@grav: how did you include it in your project?
I have no clojure-specific setting for it, eg. I just load it from ol’s cdn from my index.html
<script src="http://openlayers.org/en/v3.10.0/build/ol.js" type="text/javascript"></script>
@grav: this will help: https://github.com/cljsjs/packages/tree/master/openlayers
@grav: also search the issues in this repo for additional discussion
@martinklepsch: I tried that, but I may have used in incorrectly. Will try again, and report back
@grav there are people using this in production I think. IIRC OL is pretty big so you really want dead code elimination etc.
For trying out lein-figwheel 0.5.0-SNAPSHOT, could I do lein new figwheel foo
then just change the plugin version? Or do I need to do something prior to generating the project?
changing the plugin version should be good enough, just make sure that if any of the figwheel options have changed, that you change them in project.clj as well.
thanks
hmm packaging openlayers via cljsjs seems like a terrible idea, considering it is already closure compatible js
@thheller: it’s packaged as a :lib
instead of :foreign-lib
this way you can pull it in via maven in a form that the clojurescript compiler understands without any extra effort on the side of the user
no, it’s full closure compatible source
which makes it one of the nicest to use libs in cljsjs I think
hey guys, newbie question from a first time submission (http://dev.clojure.org/jira/browse/CLJS-1411)
the wiki says "Edit the ticket's Patch field to indicate either "Code" or "Code and Test". This makes it easier for others to find patches in need of review."
I'm not sure what this means?
is there something else I need to do or should I just wait ..?
@anmonteiro: there’s a #C07UQ678E channel
did not know that
thanks
is there a way to use your own macro with cljs-bootstrap
-compiled code? say
(defmacro unless [pred a b]
`(if (not ~pred) ~a ~b))
(unless false (println "Will print") (println "Will not print"))
the code above compiles into the following:
cljs.user.unless = (function cljs$user$unless(_AMPERSAND_form,_AMPERSAND_env,pred,a,b){
return cljs.core.sequence.call(null,cljs.core.concat.call(null,cljs.core._conj.call(null,cljs.core.List.EMPTY,new cljs.core.Symbol(null,"if","if",1181717262,null)),cljs.core._conj.call(null,cljs.core.List.EMPTY,cljs.core.sequence.call(null,cljs.core.concat.call(null,cljs.core._conj.call(null,cljs.core.List.EMPTY,new cljs.core.Symbol(null,"not","not",1044554643,null)),cljs.core._conj.call(null,cljs.core.List.EMPTY,pred)))),cljs.core._conj.call(null,cljs.core.List.EMPTY,a),cljs.core._conj.call(null,cljs.core.List.EMPTY,b)));
});
cljs.user.unless.cljs$lang$macro = true;
cljs.user.unless.call(null,false,cljs.core.println.call(null,"Will print"),cljs.core.println.call(null,"Will not print"));
however the execution result is wrong@settinghead: the rules about macros are not different between ClojureScript JVM and JS
I've been pondering, and I think the self-host macro rule ends up being: “To call a macro, it must be defined in a namespace required as a macro namespace.”
@richiardiandrea: Hey I fixed the repl-api and I just re-deployed the SNAPSHOT. Make sure you do a lein clean
before trying it.
ok, trying!
@bhauman: works now!
np any time
I get the same issue still
is there a reason lein clean
could not work as expected?
I didn’t see any downloads happen after the lein clean
and then running lein figwheel
@jeremyraines: lein clean
only works if you specify :clean-targets
what do I add there to have it clean dependencies?
@jeremyraines: what platform are you on?
@jeremyraines: it’s just a vector of file paths
ok, wasn’t sure if it was advisable to have it reach outside the project
removing it from ~/.m2 made the downloads happen, but I get this error
Exception in thread "main" java.lang.RuntimeException: No such var: figwheel-sidecar.repl-api/start-figwheel-from-lein
after that, lein clean
lein-figwheel
, same error
sorry, forgot to delete the others from m2
works now
is there a way to connect this method with the system stuff yet, for example to get CSS watching?
@jeremyraines: CSS watching works you have to configure it
awesome
oh it's been changed to figwheel-options
@bhauman: is it figwheel-options
both inside and a cljsbuild
and inside lein project?
Is there a more pretty way to map a list of things (e.g. numbers) to a list of maps than (map #(-> {:id %}) [1 2 3 4])
, i.e. something more elegant than ->
?
jannis, I’d tend to do what you’re doing more explicitly, simply using (map #(hash-map :id %) [1 2 3 4])
(whoops)
(map (partial hash-map :id) [1 2 3 4])
depends on your idea of elegance
dnolen, that doesn’t work
but, similarly you could do (map hash-map (repeat :id) [1 2 3 4])
not sure that’s an improvement or not…haha
code golf! 😛
I think Jannis’s original was the shortest actually!
at least, I can’t figure out how to make it more concise
I guess #(-> [:id %]) is fairly obvious and you can see the structure of the resulting maps right in front of your eyes.
I would recommend whichever formulation “future you” will grok the most readily
yeah, my only argument against the threading macro is that it’s not really any more clear here
christianromney, yeah.
(re: future you comment)
provided you’re not on a team with some collective idioms already established
@christianromney: Yep, good point. @dnolen: That's nice, too.
that’s a case in point. my brain naturally gravitates to partial
in these cases even though #()
is shorter
yeah, I find partial more explicit, but it requires knowledge of partial. Might be harder for beginners.
of course it depends on arg position
personally I never use partial
and suspect it’s as verbose as it is to encourage people to just use fn literals
also if you’re a perf nut depending on the compiler there are implications for partial
vs. inline fn literal
when you’re using partial, it doesn’t really make it a partial like it haskell? its more or a hack?
so partials in clojure works as any other partial function in other functional languages?
haskell’s evaluation strategy is fundamentally different from Clojure’s, being lazy, so you can’t really compare the two tmtwd
it is analogous to a partially applied function in Haskell I suppose, but you don’t need a special function for it in Haskell
@tmtwd: I'm not sure if this answers your question, but 'partial' only uncurries the arguments it needs to. You could write code like in haskell but you'd have to put partial in front of every single function!
thomasa, I’m not sure I understand what you mean by “put partial in front of every single function”…are you talking about what you would have to do in Clojure to imitate Haskell’s behavior?
I see
actually, sorry I don't mean every single function, i mean every fn with more than one argument
Anybody know when the next release of clojurescript is going to be released? I am seeing java.lang.NullPointerException at com.google.javascript.jscomp.JSModule.sortInputsByDeps(JSModule.java:263) It appears this is potentially resolved with CLJS-1469 :modules regression
@dnolen: wouldn't be awesome to add a layer on top of figwheel with cards and a in-brower repl? Voila' we have a ClojureScript IDE 😄
@richiardiandrea: I already have a ClojureScript IDE it’s called Cursive 😉
very cool indeed
@richiardiandrea: :figwheel-options
is not to be used inside the project.clj
Its only for calling figwheel-sidecar functions that kick off figwheel