This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-04-19
Channels
- # announcements (3)
- # aws (1)
- # beginners (25)
- # calva (6)
- # cider (55)
- # clara (13)
- # cljs-dev (3)
- # clojure (79)
- # clojure-europe (1)
- # clojure-nl (6)
- # clojure-spec (59)
- # clojure-uk (6)
- # clojurescript (97)
- # clojureverse-ops (2)
- # cursive (7)
- # data-science (4)
- # datomic (12)
- # emacs (8)
- # figwheel-main (19)
- # fulcro (67)
- # graalvm (3)
- # graphql (12)
- # jobs (4)
- # jobs-discuss (11)
- # lein-figwheel (5)
- # off-topic (50)
- # om (1)
- # other-languages (1)
- # planck (3)
- # quil (2)
- # re-frame (4)
- # reitit (5)
- # remote-jobs (5)
- # ring-swagger (2)
- # shadow-cljs (34)
- # spacemacs (8)
- # xtdb (1)
- # yada (4)
(type 'h1) => cljs.core/Symbol
(type (first '('h1))) => cljs.core/List
Do you guys know why the second example doesn't return Symbol?
Remember what ‘a expands to and what quoting a form does (when you’re quoting a s expression and one of its members is itself a quoted form
’(3 ‘a 4)
will be (3 (quote a) 4)
'(3 'a 4)
---read--> (quote (3 (quote a) 4))
---eval---> (3 (quote a) 4)
🙂
' expands to (quote ...), which then is evaluated to return just the thing inside which has been read, but not evaluated
' expands to (quote ...) at read time if I'm right. Because eval understands only datastructures
a quick way to check the read form is often to syntax quote in front:
`'(3 'a 4) ;; (quote (3 (quote user/a) 4))

or just quote in front too I guess
''(3 'a 4)
for exact same reasons as above
Are reading and resolving two different phases in the compiler?
"resolving" is not a phase
what do you mean by that?
and I would say reading is a different phase than compiling, not something "in" the compiler. the compiler works on data structures - they may have been read, or you may have constructed them (via macros or some other mechanism)
and a
is not equal to (quote a)
When working with promises at the REPL, am I correct in thinking that there’s no way to get the REPL to wait for the promise to be resolved and then return that value as the result of the evaluation?
There's a few methods to achieve it. One is sharedarraybuffers, which I used to implement repl waiting functionality with
But if some part of an app needs it, where you know you can get by in a worker context, you can use it
hi, what is the fastest way to start with clojure script to have a react app with reframe
I, like many others, started with https://github.com/plexus/chestnut
Is it possible to have - a foo.cljs file + - a foo.cljc file that defines a CLJS function bar and to call the bar function in foo.cljs? or this this foo.cljs + foo.cljc construction only used for referring macros?
a .cljs file should always be loaded in preference to .cljc
CLJS will load .cljs
and the :require-macros
in that will load the spec/alpha.cljc
as a MACRO ns
And the defmacros from spec/alpha.cljc can be used from spec/alpha.cljs in self-hosted mode
self-hosted works the same way in that sense. spec/alpha.cljc
will be loaded as spec.alpha$macros
ns, so it is a separate ns from spec.alpha
without the :require-macros
CLJS won't touch the .cljc
file (if a matching .cljs
file exists)
Clojure is the same way - .clj is loaded in preference to .cljc file
in other words, platform-specific overrides common
Summarized: when you have a foo.clj(s) + foo.cljc, in Clojure, the foo.cljc will be ignored and in ClojureScript only macros will be read from .cljc
foo.clj + foo.cljc Clojure: foo.clj is loaded, foo.cljc is ignored. ClojureScript: foo.clj is loaded when requiring macros, foo.cljc is ignored. --- foo.cljs + foo.clj Clojure: only foo.clj is loaded when required ClojureScript: foo.cljs is loaded when required, only macros are read from foo.clj --- foo.cljs + foo.cljc Clojure: only foo.cljc is loaded when required ClojureScript: foo.cljs is loaded when required, only macros are read from foo.cljc --- foo.cljs + foo.clj + foo.cljc Clojure: only foo.clj will ever be loaded, foo.cljc is ignored ClojureScript: foo.cljs is loaded when required, only macros are read from foo.clj, foo.cljc is ignored ---
loading CLJS code .cljs
over .cljc
. loading CLJ code (directly or via :require-macros
) .clj
over .cljc
first case was also incorrect. foo.clj + foo.cljc -> CLJS loads .cljc
and :require-macros
loads the .clj
. .cljc
is not ignored for CLJS
it loads .cljc
files in :cljs
mode so it should in theory pick .cljc
over .clj
in that case
why does the second thing cause this? Stack trace of root exception is empty; this is likely due to a JVM optimization that can be disabled with -XX:-OmitStackTraceInFastThrow. ---- Exception ---- ---- Exception Stack Trace ---- java.lang.NullPointerException: nil
If I want to use an external react widget library, do I need to write it a deps.edn so that it will be loaded after the React provided by Reagent?
Hmm... then I must be something else wrong.
Does that ring any bell?
Uncaught TypeError: Cannot read property 'PureComponent' of undefined
First I tried loading it directly via the HTML. When I got the error I thought it was because it was loaded before React, so I added the foreign-libs bit and removed it from the HTML, but still get the same error.
The error comes from the lib js itself when loading it.
I am not sure how the foreign-libs stuff works. my guess is you'll also need to provide React using the foreign-libs interface as well
I'm in a similar position; I always use cljsjs or make my own wrapper. For some particular reasons in this project I need to load everything differently and it's throwing me off.
Could it be a JS compilation issue? (I vaguely remember encountering some JS once that needed to be compiled for the browser.)
my best guess is that highcharts-react is trying to access React.PureComponent
and it's not there
Well yeah, this part I got 😛 That's the how/why I'm trying to figure out.
Yes, the whole app is running fine. It's just this library that won't load.
sry, I forget even how cljsjs works. in shadow-cljs, libs are not exposed on window
Alright. Thanks for your input, I appreciate it!
I'm leaning more and more with the JS not being compatible with cljs (webpackUniversalModuleDefinition), but I don't know enough about the subject 😕