Fork me on GitHub
#clojurescript
<
2015-06-20
>
mateusz-fiolka10:06:39

Is it possible to use clojure.zip in cljs? Is it built in?

dialelo10:06:57

@mateusz-fiolka: yes, it's ported to cljs in the clojure.zip namespace

mateusz-fiolka10:06:26

Ok, thanks - maybe I'm just doing sth stupid.

dialelo10:06:01

@dnolen: can we expect a blog post about om.next before EuroClojure or are you waiting to announce it there?

dialelo10:06:16

been lurking the repository and reading through the examples in dev.cljs and can't wait to try it out

dialelo11:06:19

strange, I fired up a REPL with the latest CLJS and I'm getting the same result as you with clojure.zipper

dialelo11:06:23

same for clojure.data

dialelo11:06:28

although clojure.set works fine

mateusz-fiolka11:06:42

Maybe it's a bug?

dialelo11:06:37

I too I'm using figwheel, not sure if it's the culprit

mateusz-fiolka11:06:37

lein cljsbuild once should allow to verify it.

dialelo11:06:03

@mateusz-fiolka: calling (enable-console-print!) before creating the zipper solves the issue for me

dialelo11:06:19

not sure why it affects the name resolution in a namespace

mateusz-fiolka11:06:48

Doesn't work for me. I was using this function before.

not-much-io17:06:42

I am using Clojurescript + Reagent + Figwheel and I keep periodically getting an error like this: Uncaught Error: No protocol method IDeref.-deref defined for type undefined I am just derefrencing an atom in another ns. Everything works after a clean build but then after a while it starts failing. Is there maybe a frequently made mistake that I am most probably making? Seems like the atom is dissapearing from the compiled code or something..

colin.yates17:06:16

@not-much-io: are you setting that atom to nil (rather than the value of that atom)

not-much-io17:06:55

A moment, I'll check to be sure, but I think not..

not-much-io17:06:42

Hmm, it is possible: I am using the following code on a slider element to reset! the atoms value: (fn [e] (reset! settings/long-break-time (.-target.value e)))

not-much-io17:06:18

If there is no .-target.value in the event then It would set it to nil.

colin.yates17:06:36

I think that is fine - it would set the value the atom is wrapping to nil

colin.yates17:06:02

I mean, if you have (def db (atom {:a (atom “hi”)})) you would need to deref :a as well as deref’ing the db. If you then did something like (reset! db {:a nil}) subsequent deref’ing of :a would throw the error you get

colin.yates17:06:12

deref’ing (atom nil) is fine

colin.yates17:06:34

@not-much-io: can you isolate into a trivially small example?

not-much-io17:06:31

In settings.cljs: (defonce short-break-time (atom 5)) In components.cljs: (fn [e] (reset! settings/short-break-time (.-target.value e))) That is really it, all the other references to this atom are just de-refrencing it, only the one single slider resets it.

colin.yates17:06:09

@not-much-io: gotta go put kids to bed - back in a bit, but that looks fine (you might want to return nil from the event handler though)

not-much-io17:06:49

@colin.yates: It's really just a minor annoyance. I am not neccesarily itching to fix it. More like I was wondering if this is an obvious often made mistake.

sveri18:06:49

@not-much-io try to avoid nil as much as possible, no matter the context

not-much-io18:06:57

@sveri: 0 uses of nil in this small project

colin.yates18:06:48

@not-much-io: stab in the dark, does it work the first time but then throw nil after figwheel updates? If so, again, another stab in the dark, try (def rather than (defonce. Trying to narrow scope of behaviour, that’s all

not-much-io18:06:20

Can't even try, I don't know what happened but now I keep getting: Uncaught ReferenceError: goog is not defined -.-

sveri18:06:22

@not-much-io Sorry, i misread this.

colin.yates18:06:49

@not-much-io: have you lein clean’ed without restarting figwheel?

not-much-io18:06:14

Yes, it fixes it, but after a while it's back

not-much-io18:06:17

And now, the goog problem dissapeared by itself...

not-much-io18:06:24

I do not have a stable setup..

colin.yates18:06:46

@not-much-io: I think you have bigger problems simple_smile. Get the setup stable first would be my advice

arohner20:06:11

in Om, can I ‘watch’ a key on appstate, and e.g. make an API call when the appstate key changes?

arohner20:06:30

I suppose I could poll in a go loop, but there’s probably a better way

samflores20:06:32

I’ve never used Om (I like Reagent and Rum), but isn’t the state a simple atom?

arohner20:06:42

oh, does add-watch work?

samflores20:06:10

idk, that’s how I do with reagent/rum 😄

sander20:06:45

@arohner: alternatively, :tx-listen on om.core/root

arohner20:06:31

@sander: I’m pretty far down in a component

arohner20:06:40

I don’t know how to get a handle on the ‘real’ root from here

arohner20:06:55

and that seems a little weird

sander20:06:37

@arohner: use will-receive-props or some react function like that?

arohner20:06:44

ah, that looks like it could work

phil22:06:17

What are the goto templates for building a new cljs app? Chestnut still up there?