This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-08-02
Channels
- # announcements (5)
- # beginners (35)
- # calva (15)
- # chlorine-clover (9)
- # clj-kondo (8)
- # clojure (34)
- # clojure-europe (6)
- # clojure-uk (1)
- # clojurescript (4)
- # conjure (23)
- # data-science (2)
- # datalog (6)
- # emacs (1)
- # events (8)
- # figwheel-main (3)
- # fulcro (10)
- # jackdaw (3)
- # joker (1)
- # kaocha (1)
- # malli (4)
- # nrepl (1)
- # off-topic (1)
- # pathom (1)
- # re-frame (4)
- # reagent (2)
- # reveal (11)
- # rewrite-clj (15)
- # rum (1)
- # sci (61)
- # shadow-cljs (1)
Hello all! I am a beginner and I'm having a hard time with clojurescript and lein.
I just installed everythin, lein is working with a vanilla clojure project, I can access repl, but when I start a new project with figwhell I can't run it. I created a project with:
lein new figwheel my-web -- --reagent
and after that entered my-web and installed all js dependencies
yarn install
and after
lein figwheel
I receive the following error:
Figwheel: Cutting some fruit, just a sec ...
Figwheel: Validating the configuration found in project.clj
Figwheel: Configuration Valid ;)
Figwheel: Starting server at
Figwheel: Watching build - dev
Compiling build :dev to "resources/public/js/compiled/out/index.js" from ["src"]...
Failed to compile build :dev from ["src"] in 1.547 seconds.
---- Exception ----
clojure.lang.ExceptionInfo : :build-cmd :none failed
Is npx installed?
If not you may need to try
sudo npm i -g npx
Your questions sounds like it rather belongs to #clojurescript or #figwheel channel instead. Try asking there instead if npm i
didn't work.
Also, I'm a bit biased on this one but you can probably give luminus template a try instead of "figwheel" template. There is a chance that's it is more up to date. https://github.com/luminus-framework/luminus-template there is "+cljs" profile hint as well
thank you @U0113AVHL2W I am still finding my way over these tools. But from my research maybe shadow-cljs should be easier to work with. I gave up on this
but I didn't anything. Should be working right???
My lein version: Leiningen 2.9.4 on Java 11.0.7 OpenJDK 64-Bit Server VM
Is there a method to stub a function in java.lang.System ns? "exit" to be exact Attempted this snippet:
(with-redefs-fn [java.lang.System/exit (fn [x] (println "stubbed exit with status code" x))]
(java.lang.System/exit 0))
It fails with:
> Unable to find static field: exit in class java.lang.System
The original motivation is to stub "exit" call in third-party package while I'm using it from REPL? That's cljfmtI may not be familiar with how you are using the word “stub” here. You want to redefine the behavior of the Java exit method?
If so, Clojure does not provide a way to redefine JVM methods
With-redefs-fn is for redefining Clojure functions, not Java methods
I do not know if the JVM’s exit method is possible to redefine, or if so, how one might do it
The JVM documentation for the exit method mentions shutdown hooks, with a link to a method that allows you to add shutdown hooks, which appear to be called shortly before the JVM actually exits, but after exit is called
@U0CMVHBL2 thank you! 🙏
This one seems to worked fine for stubbing a method:
(with-redefs [cljfmt.main/exit (fn [x] (println "aborting exit: " x))]
(#'cljfmt.main/check '("/tmp/delete/project.clj") cljfmt.main/merge-default-options))
> :profiles/test {}})
> 1 file(s) formatted incorrectly
> aborting exit: {:okay 0, :incorrect 1, :error 0}This portion of the Clojure docs doesn't seem very clear to me
;; What is inside the (commment ...) is readable, so no error for this,
;; and no code will be generated by the compiler.
(comment
(defn foo [x]
(inc x))
)
;; What is inside the (comment ...) is NOT readable, so this will give an error
(comment
a : b
)
Is there really a (commment ...)
form (with 3 m
) or is that just a typo??
https://clojuredocs.org/clojure.core/commentjust fyi, clojuredocs is a community web site with community submitted examples, not official documentation
oh okay. thanks @alexmiller 🙏
it's mostly very helpful :)
the repo is at https://github.com/zk/clojuredocs but the data is in a db iirc
How do a create a date inst programattically?
(let [s "1980-01-01"]
#inst s)
Syntax error reading source at (REPL:2:10).
class clojure.lang.Symbol cannot be cast to class java.lang.CharSequence (clojure.lang.Symbol is in unnamed module of loader 'app'; java.lang.CharSequence is in module java.base of loader 'bootstrap')
here I think you could either do (let [s #inst "1980-01-01"] s)
or (let [s "1980-01-01"] (clojure.instant/read-instant-date s)