Questions tagged [clojurescript]

ClojureScript is a dialect of Clojure that compiles to JavaScript.

ClojureScript is a dialect of that compiles to . ClojureScript's compiler is designed to emit JavaScript code which is compatible with the advanced compilation mode of the .

For more details, please visit the project website.

2300 questions
1
vote
1 answer

Clojure - protocols/multimethods overflow

In order to better understand Clojure protocols, I am asking myself if they act exactly like a cond. For instance this function may overflow : (defn my-cond [n] (cond (< n 0) (my-cond (inc n)) (> n 0) (my-cond (dec n)) :else…
nha
  • 17,623
  • 13
  • 87
  • 133
1
vote
1 answer

How to show all ClojureScript errors and output in console?

I've been trying to learn how to properly debug ClojureScript. I'm sorry if this is a noob question, maybe it's so noob that no one else ever needs to ask it, but I can't find a direct answer anywhere. I've followed these setup…
Phylth
  • 368
  • 2
  • 14
1
vote
2 answers

Placing a value at the bottom of a channel?

In Clojure(Script), is there anyway to jam a value at the bottom (as opposed to the top) of a channel so that the next time it is taken from (for example by using
George
  • 6,927
  • 4
  • 34
  • 67
1
vote
1 answer

What does (node/enable-util-print!) do?

In a ClojureScript project targetting nodejs, what exactly is going on behind the scenes with the following common statement? (node/enable-util-print!)
George
  • 6,927
  • 4
  • 34
  • 67
1
vote
1 answer

ClojureScript: Get Average RGBA Color from ImagaData

I'm trying to write a function in ClojureScript, which returns the average RGBA value of a given ImageData Object. In JavaScript, implementations for this problem with a "for" or "while" loop are very fast. Within milliseconds they return the…
Anton Harald
  • 5,772
  • 4
  • 27
  • 61
1
vote
1 answer

How to correctly use valip predicate gt with macros?

I'm working through Modern ClojureScript tutorial, and trying to write some macros to automate some things. For instance, in one of validate functions: (defn validate-shopping-form [quantity price tax discount] (validate {:quantity quantity :price…
1
vote
2 answers

Converting JavaScript websql to Clojurescript

I'm going through a tutorial below https://developer.apple.com/library/iad/documentation/iPhone/Conceptual/SafariJSDatabaseGuide/UsingtheJavascriptDatabase/UsingtheJavascriptDatabase.html and am having trouble converting js to cljs in the…
1
vote
2 answers

close! a subscription channel without unsub

What are the effects of using close! on a subscription channel without first using unsub? Will this have the effect of an implicit unsub + a close! or will there be any unwanted sideeffects doing so?
user3139545
  • 6,882
  • 13
  • 44
  • 87
1
vote
2 answers

How do I query with a join getting all the data in Om Next?

In Om Next, when having data such as: {:table {:name "Disk Performance Table" :data [:statistics :performance]} :chart {:name "Combined Graph" :data [:statistics :performance]} :statistics {:performance…
Pablo Fernandez
  • 279,434
  • 135
  • 377
  • 622
1
vote
2 answers

Using Bootstrap 3 from Clojurescript

I would like to have a React Bootstrap JavaScript file in my markup, and then use Bootstrap components from Clojurescript. I understand this simple approach (not using a cljs library) should be possible. However I am stuck at the beginning with a…
Chris Murphy
  • 6,411
  • 1
  • 24
  • 42
1
vote
2 answers

Figwheel multiple builds (dev and test) will reload in repl test not dev

We have a project, and 2 builds: :cljsbuild {:builds [ {:id "devguidelines" :source-paths ["src"] :figwheel {:on-jsload "vr.guidelines/on-js-reload"} :compiler {:main vr.guidelines …
Dan Bunea
  • 187
  • 1
  • 2
  • 10
1
vote
1 answer

How to extend protocols to ClojureScript collections generically

If you try to run the following code, you will see that it will compile, but fail at runtime on the second-to-last line due to "No protocol method NameSayer.say-name defined for type cljs.core/PersistentArrayMap: {}" even though it the satisfies?…
Amanda
  • 11
  • 2
1
vote
1 answer

Nested object as callback in ClojureScript

I'm trying to convert the following JavaScript function definition to ClojureScript to no avail: chrome.webRequest.onBeforeRequest.addListener( callback_function, {urls: [""]}, ["blocking"]); Here's the…
John
  • 3,296
  • 2
  • 24
  • 36
1
vote
1 answer

how can i do left join (more or less) in datascript?

So basically i have a list of orders, a list of order providers and a list of users Each order has a property, :order/subscribers, which is a vector of zero or more subscribers. I would like to get the count of subscribers for order. The query below…
boogie666
  • 650
  • 10
  • 24
1
vote
1 answer

Is my ClojureScript translation of this JS function idiomatic?

I am trying to assess whether my CLJS function declaration is idiomatic. Here is my attempt to convert a JS function into its corresponding CLJS function. (You can ignore the actual content of the function). JavaScript function: var dir =…
George
  • 6,927
  • 4
  • 34
  • 67