This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-12-10
Channels
- # adventofcode (9)
- # bangalore-clj (1)
- # beginners (130)
- # boot (6)
- # cljs-dev (8)
- # cljsjs (12)
- # cljsrn (3)
- # clojure (33)
- # clojure-brasil (3)
- # clojure-korea (4)
- # clojure-russia (150)
- # clojure-sanfrancisco (4)
- # clojure-spec (159)
- # clojure-uk (3)
- # clojurescript (100)
- # code-reviews (9)
- # core-async (1)
- # datascript (3)
- # dirac (58)
- # hoplon (8)
- # jobs-discuss (10)
- # luminus (18)
- # om (2)
- # onyx (14)
- # protorepl (19)
- # re-frame (34)
- # reagent (28)
hmm running into one of those situations where the error isn’t helpful 😞 https://puu.sh/sK5Hh/1491ba3a13.png
has anyone seen that before? whereabouts should I be looking for my error? (ns declaration & all requires seem fine…)
What is the runtime complexity of ClojureScript's subs
?
This might be more of a JavaScript question.
I have a basic cljs application template that loads reagent over boot. I'm trying to configure the cljs-repl. I've successfully gotten the browser to connect, but when I evaluate (+ 3 3) it gives java.lang.RuntimeException: Unable to resolve symbol: + in this context,
(I'm using the https://github.com/martinklepsch/tenzing template)
@kzeidler did you run start-repl
in the repl?
@kzeidler i.e. are you seeing something like cljs.user
in front of the repl?
@martinklepsch yes, with various flags passed while trying to spot my error. I now have a repl that loads the boot.user namespace, but seems to have a problem loading the namespace containing my app
Error that I get when calling load-file on it: clojure.lang.Compiler$CompilerException: java.lang.IllegalAccessError: atom does not exist, compiling:(/Users/kevinzeidler/rhizome/berbert/src/cljs
I take it that it's having trouble loading the Reagent dependency (it's :refer-ing to atom as the first argument to ns in that file)
@kzeidler just to be double clear, try the following:
- start the build with boot dev
- create a repl client with boot repl --client
in another terminal
- in that terminal run (start-repl)
- reload browser if necessary
- then you should see cljs.user=>
or similar
@kzeidler also refer to the documentation here: https://github.com/adzerk-oss/boot-cljs-repl
I did see those docs, but I'm unsure if the project skeleton requires those modifications to boot the repl. Does it?
you said you tried (start-repl)
with various flags but it doesn't have any flags so I'm not sure what you're referring to...
the project skeleton is setup so you you should not need to make any further modifications
martinklepsch: running via terminal with your instructions worked like a charm. Thanks!
@kzeidler I think the step you missed is calling (start-repl)
once you're in a repl in the boot.user
namespace
For reference, which of those instructions does the nrepl connection step for Cursive override? Do I still need to call start-repl?
also you may want to pass a port to the cljs-repl
task so that you can connect to the same port every time with cursive: https://github.com/adzerk-oss/boot-cljs-repl#cursive
@kzeidler what cursive does (guessing but seems likely) is basically boot repl --client
so that's the step that's replaced
(start-repl)
is really the most critical step 😉
martinklepsh: I think possibly one of my problems earlier is that I read those docs, and added cljs-repl to (build) not realizing it was in run
martinklepsch: this is too cool. basically the cljs reloadable config I was dreaming about, but couldn't quite configure on my own. thanks so much for providing it
@kzeidler realized that there's also this in the tenzing readme: https://github.com/martinklepsch/tenzing#connecting-to-the-browser-repl — did you see that?
@kzeidler you're welcome 🙂
I did. This very likely is a Cursive issue, the instructions worked great when I entered them in the terminal
(I have seen tickets on the Cursive github that suggest it's not fully compatible with boot, although some people insist it's possible with some workarounds)
Ok. Dunno if Cursive allows you to just connect to an nrepl port without anything else but if so it should work pretty much the same
martinklepsch: sorry, one small bump I'm still trying to hammer out: the build pipeline sets up a watch already that recompiles the origin file if any changes are made. The nrepl doesn't appear to reload those definitions, at least right out of the box. Is it possible to configure the repl to do so?
@kzeidler are you talking about changes to clojure files or to clojurescript files?
@kzeidler Not much time sorry, packing for a flight, but you can connect to an nREPL port with Cursive using a Remote REPL config.
So you can run boot in the terminal, and then connect to localhost and the port it’s using.
If you’re still having problems, ask in #cursive, or drop me a mail on <mailto:[email protected]|[email protected]>
(defn jsonp [uri & opts]
(let [{:keys [on-success on-timeout content callback-name callback-value timeout-ms]} opts
req (goog.net.Jsonp. uri callback-name)
data (when content (clj->js content))
on-success (when on-success #(on-success (js->clj % :keywordize-keys true)))
on-timeout (when on-timeout #(on-timeout (js->clj % :keywordize-keys true)))]
(when timeout-ms (.setRequestTimeout req timeout-ms))
(.send req data on-success on-timeout callback-value)))
(jsonp ""
{:callback-value “callback"
:on-timeout(fn [result] (js/console.log "Call timeout"))
:on-success (fn [result] (js/console.log "This is a callback function for successful requests”))})
Uncaught ReferenceError: callback is not defined
at spot.js:1
(anonymous) @ spot.js:1
😞How does one go about getting JSONP in clojurescript?
Hi! Btw...
var callback = function(result){console.log(result);};
in the console and calling the function from the cljs repl works…
So… How do I get it working in CLJS?
@crankyadmin everything is namespaced in cljs
My problem is that Amazon always return the callback as callback
regardless of whether I use ”
Doesn’t work without it either… I was clutching at straws hoping for the best.
> ah amazon doesn't let you override it 😄
PITA.
I suspect I’m going to have to do something nasty to make it work 😐
I deal with AWS day in day out… for seven years… this is probably the least weird thing I’ve ever seen them do. Sweet, I’ll try that once I’ve grabbed a coffee!
@thheller That worked. Cheers bud!
is there something like a partial-first
? So that ((partial f b c) a)
equals (f a b c)
?
don't think it is likely to exist since partial
creates a function that accepts more than one extra arg
Externs Inference - https://gist.github.com/swannodette/4fc9ccc13f62c66456daf19c47692799
@dnolen wohooo, interesting 👍
@martinklepsch yeah big deal when you need to integrate random libs quickly
I guess the warnings show up in :none
as well?
gotta sleep but will give this a spin tomorrow!
this is huge 😉
Essentially this would mean if I define constructors with the type hint on the returned value I would not need to worry about externs anymore, do I understand that right?
@martinklepsch yes this is my understanding as well
Very very cool
@martinklepsch well as long as the thing returned also has an extern of course