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.

2149 questions
68
votes
5 answers

Private def in clojure/clojurescript

In Clojure and clojurescript you can have a private version of defn called defn-, but how do you do the same for def, as def- doesn't seem to be included?
yazz.com
  • 52,748
  • 62
  • 227
  • 363
40
votes
8 answers

Any clojurescript tutorials?

Are there already some good tutorial on ClojureScript? I would like to try it out, but don't know where to start exactly.
Michiel Borkent
  • 31,814
  • 15
  • 78
  • 134
40
votes
3 answers

How does Elm compare to ClojureScript?

I'm reaching a point where GUI coding with Backbone.js object-oriented MVC pattern is getting quite complex, and looking around at other paradigms. MDV, FRP, ECS, oh my. How does Elm compare to ClojureScript? Where do they overlap? Both are…
forresto
  • 10,895
  • 6
  • 41
  • 62
36
votes
1 answer

What is the difference between application state and component local state in Clojurescript Om?

I have gone through David Nolen's basic Om tutorial but I am still a bit confused about the difference between application state and component local state. When cursors are referred to is it referring to one or both of these too?
yazz.com
  • 52,748
  • 62
  • 227
  • 363
34
votes
2 answers

deftype vs. defrecord

While defrecord is the preferred form -for the general case- in Clojure for defining an "entity", in ClojureScript one can find far more references to deftype, as reflected in various documentation. What is the difference between both forms? Which…
deprecated
  • 4,948
  • 3
  • 38
  • 58
32
votes
2 answers

Javascript interop assignment in Clojurescript

Dumb question: how do I do Javascript assignment in Clojurescript ? I'm using a Javascript lib and need to set the value of an object's field like obj.this=that; - I don't know Javascript so maybe there's a .set method ?
Hendekagon
  • 4,405
  • 2
  • 25
  • 42
32
votes
4 answers

How can I get Clojure :pre & :post to report their failing value?

(defn string-to-string [s1] {:pre [(string? s1)] :post [(string? %)]} s1) I like :pre and :post conditions, they allow me to figure out when I have put "square pegs in round holes" more quickly. Perhaps it is wrong, but I like using them…
Stephen Cagle
  • 12,627
  • 14
  • 49
  • 83
30
votes
1 answer

Is it possible to use :refer :all in a ClojureScript :require?

I'm just trying out ClojureScript, starting out by converting something I wrote in Clojure into cljx. When I try to compile it I get: clojure.lang.ExceptionInfo: :refer must be followed by a sequence of symbols in :require I'm finding some oblique…
interstar
  • 22,620
  • 31
  • 101
  • 161
29
votes
5 answers

How to Debug ClojureScript

I apologize for this seemingly stupid question, but I've been playing with ClojureScript on and off for a few weeks now, and I can't figure out this one simple question: How do I debug ClojureScript? So here is the problem: I write my *.cjs files I…
user1383359
  • 2,583
  • 2
  • 22
  • 30
28
votes
1 answer

Accessing "this" in Clojurescript

Is there a way to access the "this" object in clojurescript? I am having issues with event propagation when I wrap an icon with an anchor and try to attach a handlder to the anchor. Without access to "this" in the handler I am constantly dealing…
Jon Rose
  • 1,379
  • 1
  • 13
  • 24
27
votes
3 answers

Clojure & ClojureScript: clojure.core/read-string, clojure.edn/read-string and cljs.reader/read-string

I am not clear about the relationship between all these read-string functions. Well, it is clear that clojure.core/read-string can read any serialized string that is output by pr[n] or even print-dup. It is also clear that clojure.edn/read-string…
Neoasimov
  • 1,101
  • 10
  • 17
27
votes
1 answer

What is the advantage of core.async in clojurescript?

Everybody is talking about how great core.async is, and how it will improve event handling in clojurescript. I've been following the ClojureScript 101 tutorial, and I don't see any clear advantage from these code examples. What am I missing? Why is…
Imogen
  • 361
  • 3
  • 6
26
votes
2 answers

Clojure <> ClojureScript; e.g: the "format" function

There is this very handy function in Clojure, which is called format. It's known for it's ability to easily template strings. The function is commonly available in most of the programming languages. I was a bit irritated to discover that…
Anton Harald
  • 5,402
  • 2
  • 17
  • 45
26
votes
3 answers

How do I setup a Clojurescript REPL with emacs?

I'm trying to setup an environment for Clojurescript. The problem I'm having is not knowing how to set it up so that I can connect to a Clojurescript Browser REPL from emacs, so I can evaluate forms right from the editor and have it show up in the…
Chris Bui
  • 1,005
  • 1
  • 13
  • 24
26
votes
3 answers

How to catch any Javascript exception in Clojurescript?

In my communication layer I have a need to be able to catch ANY javascript exception, log it down and proceed as I normally would do. Current syntax for catching exceptions in Clojurescript dictates that I need to specify the type of the exception…
1
2 3
99 100