Fork me on GitHub
#clojurescript
<
2015-07-10
>
zane02:07:24

@bhauman: Got the crashverse approach working for my project. Thanks for the leg up!

zane02:07:36

I think I ran into this along the way, which is interesting. https://github.com/bhauman/lein-figwheel/issues/116

zane04:07:00

@bhauman: When I start figwheel in crashverse with lein figwheel test and then add a new test in crashverse.core-test figwheel doesn't appear to be picking it up.

zane04:07:04

It's very weird.

zane04:07:31

If I run the tests in the REPL with (cljs.test/run-tests 'crashverse.core-test) it picks them up.

zane06:07:22

Interestingly it picks up new assertions, but not new tests.

zane06:07:15

Touching the test runner file will force the reload.

crisptrutski09:07:47

@dnolen: is there something like cljs.test/run-tests which takes specific deftest vars, rather than a wholesale namespace? (nevermind, found cljs.test/test-vars - was expecting a macro not a function simple_smile )

julianjelfs09:07:18

trying to write a function to generate all tetrominos (no de-duping for rotations yet). I think it works but I'm not sure how to avoid the nesting in the resulting data structure https://gist.github.com/julianjelfs/81e2dd976625f31574ff

julianjelfs09:07:44

I need to somehow flatten the result - but flatten is not quite what I want. Any advice?

kongeor09:07:57

mapcat identity ?

kongeor09:07:57

@julianjelfs: a colleague of mine did it using the code above simple_smile

julianjelfs09:07:21

@kongeor: yeah someone else mentioned that. But I'm not clear where exactly it slots into the code.

kongeor09:07:23

@julianjelfs: (mapcat identity (for ...)) ?

julianjelfs09:07:11

@kongeor: seems to make sense. I'll give it a go (then I'll have to make my brain understand why it works). Thanks.

bostonou10:07:05

@teslanick: i didn’t see you get an answer to your Promise.all in core.async question. Here’s an in-progress example that should give you what you want: https://gist.github.com/bostonou/916ca98b56b694ff10fd

bostonou10:07:16

@teslanick: I don’t believe there’s a built-in fn that gives you everything Promise.all does

crisptrutski10:07:40

@julianjelfs: (apply concat (for …))) would skip mapping everything through identity if you care

crisptrutski10:07:56

and the transducer version: (into [] cat (for …))

julianjelfs10:07:51

@crisptrutski: ah interesting - thanks.

crisptrutski10:07:09

mapcat is using apply concat under the hood simple_smile

slipset10:07:01

@crisptrutski: almost the same discussion going on in #C053AK3F9 Wondering what @stuartsierra has to say about mapcat

crisptrutski10:07:54

first [& [cheeky-optional-arg]], now concat? damn @stuarstierra hates my code 😉

crisptrutski10:07:55

ok, so he’s specifically talking to misunderstanding concat with repeated applications, not this case (phew)

Petrus Theron10:07:30

Getting this error when I try build my cljs app with boot:

clojure.lang.Compiler$CompilerException: java.io.FileNotFoundException: Could not locate cljs/env__init.class or cljs/env.clj on classpath: , compiling:(cemerick/piggieback.clj:1:1)
          java.io.FileNotFoundException: Could not locate cljs/env__init.class or cljs/env.clj on classpath: ...
So I created ~/src/cljs/env.clj, but no luck

lucien.knechtli10:07:22

are you missing a dependency for piggieback?

afhammad10:07:35

accessing an Om cursor within a go loop however the data returned is outdated. I'm guessing this has to do with how go blocks work?

andrewmcveigh10:07:06

@petrus: Maybe you’re using the latest clojurescript, which requires clojure 1.7*, and boot is using clojure 1.6

andrewmcveigh10:07:44

You’ll need to set the clojure version to 1.7 in boot.properties

Petrus Theron10:07:34

ah, thank you. Yeah if I take out my clojure and cljs versioning I get this warning: WARNING: Different CLJS version via transitive dependency: 0.0-2816

crisptrutski10:07:59

boot show -p will help debug version resolution

Petrus Theron10:07:44

Thanks! all sorted. Pinned Clojure version in boot.properties and put in latest cljs dep in build.boot.

bhauman13:07:05

@zane: You may have missed the ^:figwheel-always part??

dnolen14:07:57

@mfikes's neato boostrapped ClojureScript REPL (Replete) hit Hacker News (I know, I know). Under the new submissions, feel free to represent! simple_smile

mfikes14:07:41

That'd be some great exposure for ClojureScript in a new light. :)

Lambda/Sierra14:07:47

@slipset @crisptrutski: Yes, my warnings about concat were specifically about repeatedly calling it on the same object. The same warnings would apply to mapcat as well, although it's less likely mapcat would be used that way.

zane15:07:54

@bhauman: Nah, I was getting that behavior with an unmodified crashverse repo. It has ^:figwheel-always on the crashverse.test-runner namespace.

zane15:07:17

I tried adding it to the crashverse.core-test namespace as well, but that didn't seem to help.

zane15:07:34

It's definitely reloading the file, it's just not picking up new test vars.

zane15:07:44

Presumably because they're not being used anywhere?

zane15:07:05

Or maybe Google Closure is removing them?

bhauman15:07:01

@zane: when you say new test vars you mean that when you define a new test, its not showing up?

zane15:07:28

Adding new assertions to existing tests works fine.

bhauman15:07:02

@zane: add :recompile-dependents true to the test build config

bhauman15:07:17

@zane: in :compiler

zane15:07:50

Also, interestingly, it will run the new tests if I do it from the REPL.

bhauman15:07:46

@zane: what needs to happen is that the run-tests line needs to be recompiled not just rerun.

zane15:07:11

What's still confusing me is why it picks up new assertions.

zane15:07:19

You'd imagine it'd be all or nothing.

bhauman15:07:25

@zane: its a macro that pulls in ns data based on the current compile env

zane15:07:04

That did it.

zane15:07:19

Thanks! Should I push up a pull request to that repo, or does it matter?

bhauman15:07:45

yes please do that and please consider that wiki page

zane15:07:53

I definitely will!

zane15:07:09

@bhauman: Would it be helpful to get a minimal test case for https://github.com/bhauman/lein-figwheel/issues/116 , or is that expected behavior?

bhauman15:07:47

@zane: Yes it really would be great to have a minimal test case.

alwaysbcoding18:07:24

has anyone else been having a problem where lein cljsbuild auto won't compile .cljc files?

gtrak18:07:12

yea, lein doesn't support it yet

gtrak18:07:52

oh wait, i parsed that wrong

gtrak18:07:12

cljsbuild is probably lagging

alwaysbcoding18:07:22

@gtrak thanks, that's definitely the issue I'm having, but I'm a little confused by what the solution is

gtrak18:07:06

i think the solution is to change your cljsbuild dep to a snapshot version

gtrak18:07:53

or 1.0.6 release

alwaysbcoding18:07:08

so put [lein-cljsbuild 1.0.6] in the :dependencies section of project.clj in addition to in :plugins ? I'll try that

alwaysbcoding18:07:37

yea that didn't work. how do you change your cljsbuild dep to a snapshot version?

gtrak18:07:13

there isn't one

gtrak18:07:37

check that cljsbuild 1.0.6 is being used with lein deps :tree

gtrak18:07:47

one of the people on the thread said that wasn't guaranteed

alwaysbcoding18:07:37

yeah when I do lein deps :tree cljsbuild doesn't even show up. I think that's because it's in the :plugins section of project.clj and not the :dependencies section? idk this stuff is really confusing.

gtrak18:07:57

the plugin includes itself as dependencies probably

gtrak18:07:03

at least, it might

alwaysbcoding18:07:25

it looks like this is the solution from that github issue page

alwaysbcoding18:07:29

"I explicitly excluded cljsbuild in the figwheel dependency and added cljsbuild 1.0.6 explicitly. Seems to be fine now."

bhauman18:07:34

@alwaysbcoding: so I should update figwheel to point to 1.0.6?

alwaysbcoding18:07:08

I think? haha I have no idea I'm a total noob, just trying to get this to work

bhauman18:07:06

OK cool. I probably should do that soon anyway

arohner18:07:19

advanced compilation / modules question: I have a single-page Om app, I’m using bidi for routes. rendering the correct page is currently: (let [active-page page (condp = current-route :foo foo/foo :bar bar/bar …)] (om/build active-page)

arohner18:07:57

I’m guessing that because I require all of the page components, and they all appear in the same render fn, I’m not going to get very good splitting from using cljs modules. Is that right? Anyone have a good solution?

arohner18:07:36

I could replace the cond with a multimethod, but then I need to make sure namespaces don’t get compiled away

dnolen18:07:28

@arohner: namespaces aren’t going to get compiled away - modules define entry points

arohner18:07:59

@dnolen: unreferenced namespaces don’t get dropped in advanced compilation?

arohner18:07:08

ah, but if they’re listed in a module, they remain

dnolen18:07:17

that’s right

dnolen19:07:10

time to eval a trivial expression with ClojureScript bootstrapped to Node.js - ~500ms

dnolen19:07:15

Clojure 1.7.0 ~700ms

dnolen19:07:20

not that different simple_smile

dnolen19:07:02

this is comparing boot time (not reading/compilation/etc.)

gtrak19:07:12

in clojure you need to 'require' a ns to load its multimethod impls, won't that still be the case in cljs, which means there will always be a dep from an entry point?

dnolen19:07:53

@gtrak: on the multimethod not the implementers, so doesn’t matter much

gtrak19:07:37

err, right, i mean the impl ns, in the case that it's separate from the defmulti-containing ns.

arohner20:07:40

ok, so I think I have my modules correctly split up, but how do I use it in optimzations :none? when using modules, I can add to :module :entries. In :optimizations :none, modules aren’t supported, so then it seems that I have to explicitly require the two modules somewhere?

arohner21:07:46

that seems to make it hard to use modules in production + :optimizations :none in development

dnolen21:07:42

@arohner: shadow-build supports modules under :none.

arohner21:07:58

what is shadow-build?

dnolen21:07:03

a enhancement patch is welcome, but to be honest, I would just configure this type of thing via my webserver setup

dnolen21:07:13

@arohner: an alternate ClojureScript build tool

arohner21:07:30

for some reason, differences in how dev vs. prod load annoy me. I suspect it’s partly just lack of familiarity / being uncomfortable with the tools, and JS

dnolen21:07:24

it’s just more code to add to the compiler that I’m not particularly interested in working on myself

dnolen21:07:28

if you want it, submit a patch

dnolen21:07:00

otherwise I see no issues with just handling this via lein-environ or whatever you like

dnolen21:07:10

in your HTML templates

dnolen21:07:29

(:module :foo) -> just returns main in :dev and returns the specific file in :prod or whatever

arohner21:07:28

can I use goog.require to load a :optimizations :advanced module at runtime?

dnolen21:07:07

goog.require isn’t really available under :advanced optimizations

dnolen21:07:24

there is a separate async module loader thing that can probably be made to do what you want

dnolen21:07:27

but I’ve never used it