This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-03-15
Channels
- # admin-announcements (25)
- # beginners (21)
- # boot (487)
- # cider (8)
- # clara (2)
- # cljsrn (35)
- # clojure (44)
- # clojure-austin (6)
- # clojure-russia (211)
- # clojure-uk (25)
- # clojurescript (225)
- # core-matrix (1)
- # data-science (3)
- # datomic (23)
- # events (1)
- # hoplon (9)
- # immutant (14)
- # jobs (1)
- # jobs-discuss (5)
- # ldnclj (3)
- # lein-figwheel (2)
- # off-topic (2)
- # om (65)
- # onyx (65)
- # parinfer (3)
- # pedestal (4)
- # proton (1)
- # protorepl (1)
- # re-frame (16)
- # reagent (3)
- # ring-swagger (1)
- # specter (11)
- # untangled (1)
- # yada (8)
@george.w.singer: I’d try :refer-macros
as in [cljs.core.async :refer-macros [put! chan <! >!]]
@mfikes: thanks for the suggestion, but unfortunately it didn't work.
@george.w.singer: Hrm. Well. Hopefully this helps, for inspiration as to something that works: https://github.com/clojure/clojurescript/blob/c3899acf797eb6779c53b313f5606c5018360b83/src/main/clojure/cljs/repl.cljc#L778-L779
@george.w.singer: I also wrote about it here, but I don’t think it adds anything to what you have already tried, honestly: http://blog.fikesfarm.com/posts/2015-12-02-clojurescript-repl-auto-require.html
Wow -- I came across that before asking on Slack from Googling
Crazy coincidence lol
@george.w.singer: Oh, wait. The macros for core.async
are in a different ns
right?
cljs.core.async.macros
Dang. Well, that’s why it doesn’t work. Seems like you might need a :repl-require-macros
option added. Hmm.
I just tried :repl-require-macros '[[cljs.core.async.macros :refer-macros [go]]]
and that also didn't work
@puppybits: that would be a reduce
, where you collect what you need for the "next" step I guess
just an idea
You can iterate over the list and the list offset by 1
(def items '(1 2 3 4 5))
(map #(vector %1 %2) (cons nil items) items)
=> ([nil 1] [1 2] [2 3] [3 4] [4 5])
Anybody pretty familiar with re-frame that could give me some assistance? I've been stuck for a while on this: I have a reaction that I expect to resolve to a vector, but it resolves to cljs.core.ValSeq which has been super troublesome and difficult to debug
I've been stuck on this bug for quite a long time, not really sure how to debug what's going on because I don't really know what to expect either
https://github.com/Day8/re-frame/blob/master/examples/todomvc/src/todomvc/subs.cljs#L25
Handlers have parameters of the format [db [event-name & args]]
. So unless you use the trim-v
middleware, your parameters needs to add the event name.
https://github.com/Day8/re-frame/blob/master/examples/todomvc/src/todomvc/handlers.cljs
[also if I'm able to do that first step, can apply
then operate on it? [bunyan logging methods want the args expanded inline but I will have a vector of them]
Does anyone know if Onyx works on Clojurescript? I saw some archived posts where that was mentioned as a possibility.
Quick couple of questions: I want to use https://github.com/google/closure-compiler/blob/master/contrib/externs/maps/google_maps_api_v3.js in a luminous project. I've dropped it into `/target/cljsbuild/public/js/. Is that the right place for it and how do I properly import that into my core.cljs file to use it?
@bwstearns: You’re usually better off getting the dependency from clojars if you can...
Sorry, the second is what you wanted… not a wrapper, just the javascript in the right place with the ‘externs'
@smw You're the best! thanks. New to clojure/cljs. I saw cljsjs earlier but I misunderstood what it was.
@cjmurphy: it doesn't work on clojurescript. There's nothing technically stopping it, but it would require a pretty big refactoring.
has anyone run into something like: Uncaught TypeError: Cannot read property 'mount_components' of undefined
? I think it's saying that myapp.core.mount_components
is undefined, but it wasn't a while ago.
does "extern only" mean that you don't explicitly import google maps cljsjs in the .cljs file where you're using it?
Any hints on how to define how a type made with deftype prints with pr-str? In Clojure I am implementing a method on the print-method multimethod, but it seems to be different in Clojurescript unfortunately.
@casperc: you must implement IPrintWithWriter
https://funcool.github.io/clojurescript-unraveled/#printing
you're welcome! thanks for the kind words, we have to update some stuff and finish the project but we did it all in our spare time
@bwstearns: Google naps api files have to be loaded from their js server and because of that the cljsjs package can only provide the externs
I think you still need to require cljsjs/Google-maps though to ensure the externs are loaded for compilation
@dialelo: @niwinz wondering if you have investigated goog.Promise as underlying promise library for promesa... Would be curious to hear why you went with bluebird
@martinklepsch: is mainly explained here https://github.com/funcool/promesa/issues/11
however, it shouldn't be too difficult to adapt goog.Promise
for using it with promesa's API https://github.com/funcool/promesa/blob/master/src/promesa/protocols.cljc
question about Promesa for Clojure. When would I use that instead of Clojure's own promise
, when developing in Clojure (not Clojurescript)?
@daan them ara pretty different and has different purposes. But the main difference is that the clojure promise and future has blocking api
promesa in CLJ uses CompletableFuture, that is highly composable and has proper async api.
it also gives you more control on how they run; you can provide your own j.u.c.Executor for running callbacks
is promesa compatible with manifold by any chance? I recall manifold extended CompletableFutures
Is not directly compatible, but is easy to make the promesa api work in the same way with manifold deferreds
@niwinz: when you say "composable", do you mean you can chain them in a way? Monad-like? That is what I sometimes miss in Clojure coming from Scala. To be able to map over promises and apply functions over the results without actually having to wait for the result.
@dialelo: @niwinz thanks for the pointers will give it a try when I'll use promesia
Has anyone played with core.match
and ClojureScript ? I would like to know if it increases the size of the output JS files. My understanding after reading the wiki it that it will generate efficient conditions code via a macro and not embed some kind of engine (therefore a reasonable size increase). Is that correct ?
I wonder, I'm using cljsjs/chartist, and the extern file only lists the most used functions. Would there be a specific reason the whole Chartist api isn't included, or is it just likely that whoever wrote it only included what they personally needed?
@nha should be fine but be careful when using it inside core.async
go blocks, that might lead to an explosion in size
@thheller: Thanks do you have a link as to why with core async it changes ? (just curious)
there is very little information about the size of libraries in cljs (I realise the closure compiler complicates things of course)
right I get that - I just think that JS devs are more sensitive to size than we are generally
> and nobody writes the strict style the closure compiler requires by hand well, some google devs do, for example the chrome/webkit devtools team does
but still .. even most of the new stuff coming from google isn't written in closure style
Is there something like https://github.com/technomancy/slamhound for ClojureScript?
Hi folks! I have a (maybe somewhat dumb) question about Figwheel. When I run lein figwheel
in my terminal, it knows it has to pickup the dev
build. How does it know that? And what happens when I add another build that uses Figwheel?
you can specify builds via command-line: lein figwheel build1 build2 …
(this works the same as lein cljsbuild
), other option is to configure it via figwheel’s config in project.clj
I understand that, but I'm wondering how Figwheel understand to pick up my dev
profile when I don't specify a profile on the command line at all
Ah, didn’t realize you were talking about core.async. As far as I know you just use alts to circumvent a timeout and let it run out without effect.
@cjmurphy: If you create it as a snippet, it’ll hide all but the first bit. You can edit the above post.
Background: this is a function that takes a time in ms and a callback and returns a function that collects callback arguments so the callback is only called once every X ms with all arguments provided in the current time window.
@jannis sounds like you want to core.async alt!
over one timeout and one channel that collects the arguments
(go-loop [count 0]
(alt!
(timeout 1000)
([_]
(println "In timer at " count)
(recur (inc count)))
poison-ch
([v]
(println "[printer-component] stopping"))))
@thheller: That creates a loop that keeps running. What I am trying to go for is a one-shot-reschedulable argument-collecting timeout. If you don't call the collecting function at all, it never runs. If you call it once, it schedules the timeout once. If you call it twice with <X ms in between, it reschedules the timeout with the second call. If you call it twice with >=X ms in between, it schedules the timeout once for the first call and then a second time for the second call. Does that make sense?
I'd be ok with it if it doesn't involve a permanent loop (unless it sits and waits most of the time) and if timeouts can be pushed back / rescheduled.
@darwin Any idea if chromex can be used with a figwheel/boot-reload-like live updating dev workflow?
I have a question for integration testing with Phantom, in particular I would like to test reading (async Ajax fetching) served files
Now I am using lein-doo
but I saw that Phantom can act as webserver
what is a good way to achieve this?
@richiardiandrea I'd say that's not really the user case for phantom's built in server
@pandeiro: thanks for answering, so you would boot up a stand alone server for that right?
is it possible to partially apply a javascript object method with its this
?
e.g., from bunyan lib. want to do: (partial (.-info log) log)
[or something like it]
[also if I'm able to do that first step, can apply
then operate on it? [bunyan logging methods want the args expanded inline but I will have a vector of them]
so, the short answer is: ClojureScript's partial
and apply
only operate with ClojureScript functions?
@johanatan: You can also use it with JS functions that don’t care about the value of this
. 😉
@darwin: @cky: here's the final version (pretty handy tool for anyone using bunyan): https://gist.github.com/johanatan/2e6540e9e3e198bac875
in Javascript, 46245 << 16
= -1264254976
in Clojure, (bit-shift-left 46245 16)
= 3030712320
Is this related to JavaScript number precision being only 53 bits?
anyone know how I can get the same result in Clojure?
FWIW, the solution is: (unchecked-int (bit-shift-left 46245 16))