This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
- # announcements (4)
- # beginners (110)
- # boot (6)
- # calva (23)
- # cider (14)
- # cljdoc (5)
- # cljs-dev (50)
- # cljsrn (3)
- # clojure (105)
- # clojure-europe (3)
- # clojure-italy (46)
- # clojure-nl (6)
- # clojure-spec (19)
- # clojure-sweden (1)
- # clojure-uk (78)
- # clojurescript (66)
- # core-async (5)
- # cursive (19)
- # data-science (16)
- # datomic (3)
- # events (2)
- # fulcro (11)
- # hoplon (53)
- # jobs (4)
- # jobs-discuss (6)
- # keechma (51)
- # leiningen (3)
- # nrepl (25)
- # off-topic (95)
- # parinfer (8)
- # precept (1)
- # reitit (61)
- # remote-jobs (1)
- # rewrite-clj (75)
- # ring-swagger (2)
- # robots (3)
- # shadow-cljs (43)
- # tools-deps (28)
- # vim (2)
👋 I wanted to start playing with clojure and corda… I added
to project.clj and ran
lein repl, I get this:
are there any immediate gotchas I should be aware of? 🙂
=> (require 'net.corda.core) FileNotFoundException Could not locate net/ccorda/core__init.class or net/ccorda/core.clj on classpath. clojure.lang.RT.load (RT.java:463)
hi guys quick question is there a way to https://github.com/clojure/tools.trace a macro?
I doubt there is - with cider I'm getting
Var #'... can't be traced because it's not bound to a function.
Hello. I have no problem running on Macos, but on Windows
npx complains that 'clojure' is not found on system path. See screenshot. Any idea how to fix?
I’d bet shadow-cljs is looking for
clojure specifically. It might be as simple as copying
CLOJURE.BAT, but istr there’s some subtle difference between the two.
Thanks @UGPM7GTKJ! You were (partly) right. I'll have to investigate further if I find the time today but it's not quite working yet.
On my system,
clj is just an rlwrap’d
clojure is a pretty involved shell script that wraps a
java clojure.main call.
I’ve heard the Windows story is more complicated, and I no longer have any Windows machines to investigate. Sorry.
I am not the original author, so cannot answer why the original author chose that implementation of
update-in, but I can make a guess. I suspect it may help with performance to do it that way, rather than making update-in recursive. update-in take a variable number of args using
& args at the end of its arg list, but
up does not.
Hi. I am wondering what pattern or language construction functional programming (including Clojure) uses in order to get the first successful result. Lets say I have functions A, B, C. Function A checks if function B or C returns the result not equal to 0 (for example). The important part - function A checks the returns of B and C in order. Which means function A returns B if B returns not 0. And functions A returns C if B returns 0. How do I solve such kind of problem in Clojure? 🙂
Do you want function A to return "the function B" if B returns a non-0 value? Or do you want function A to return "the value that function B returned"
@andy.fingerhut I am coming here from OOP world. I assume I would like to have the scenario "the value that function B returned", not "the function B". I am basically wondering if it is possible to overcome this problem without repeating the check twice in terms of memory (to not store the result of B) and CPU (to not run the B twice).
That stores the result of B, but I have a hard time imagining how you check whether the result of function B was 0 or not, without storing it somewhere, at least temporarily.
One common case is to have function B return nil to indicate “not the value you want,” then you can just do
(defn a [x] (or (b x) (c x))
@U9WPNPZE3 This is the best solution: adopt
nil as return value. Note that you can keep stacking options in
(or a b c d e f g…), and it'll return the first truthy alternative.
sorry to have asked then jetted yesterday. I added
[net.corda/corda "4.0"] to the :dependencies in project.clj, and from the lein repl, when I do (import ’corda.core), I receive
ClassNotFoundException corda.core java.net.URLClassLoader.findClass (URLClassLoader.java:382). Do I need to insert the import statement into its own module and then import that namespace instead of trying to play around with the library directly from the repl?
=> (require 'corda.core) FileNotFoundException Could not locate corda/core__init.class or corda/core.clj on classpath. clojure.lang.RT.load (RT.java:463)
=> (import 'net.corda.client.jackson) ClassNotFoundException net.corda.client.jackson java.net.URLClassLoader.findClass (URLClassLoader.java:382)
=> (import 'net.corda.core.concurrent.JacksonSupport) ClassNotFoundException net.corda.core.concurrent.JacksonSupport java.net.URLClassLoader.findClass (URLClassLoader.java:382)
=> (import 'net.corda.core.client.JacksonSupport) ClassNotFoundException net.corda.core.client.JacksonSupport java.net.URLClassLoader.findClass (URLClassLoader.java:382)
=> (import 'net.corda.core.client.jackson.JacksonSupport) ClassNotFoundException net.corda.core.client.jackson.JacksonSupport java.net.URLClassLoader.findClass (URLClassLoader.java:382)
=> (import '(net.corda.core.client.jackson JacksonSupport)) ClassNotFoundException net.corda.core.client.jackson.JacksonSupport java.net.URLClassLoader.findClass (URLClassLoader.java:382)
Are you running leiningen? You might get something informative out of running
lein deps :tree and searching for corda-related strings.
Looks like the corda stuff wasn’t pulled down from the repo before, and you just downloaded everything when you ran
lein deps :tree — I think your import statement should work now?
@heath so the thing is
net.corda/corda is some kind of example project or a runtime, you need specific parts of it like,
net.corda/corda-jackson as lein deps
yeah i'm not sure why there is corda/corda jar, it has just 2 classes you able to import and run
CordaCaplet and they are in the default package, so you import them just by
(import Capsule) or
(import CordaCaplet) then run their main method
Hi there. I'm having recurrent problems with example apps and tutorial code not compiling because "Call[s] to clojure.core/refer-clojure did not conform to spec" - unfortunately I don't quite understand how to read the spec error messages and I can't seem to find any ns-forms that appear to be off syntax-wise. I've tried to read up on spec but I could not really gather what the messages try to tell me. Any hints on this maybe, some recommended reading?
Well I can post the spec, the trace is humongous and the code is from https://github.com/omnyway-labs/re-crud/tree/master/example-app
the code was written for 1.8 and I've got 1.9 installed, I figure this is a compatibility issue but again, I'm having a hard time reading up on that
oh that's probably right - best bet is probably to look for a newer figwheel plugin version
also probably change
[com.cemerick/piggieback "0.2.1"] to
if you read the stacktrace backwards, you see a chain of namespaces loading each other figwheel_sidecar.repl_api => figwheel_sidecar.system => figwheel_sidecar.repl => clojure.core.async
that was something fixed long ago so using an old version of core.async that can be updated
fixed here https://github.com/clojure/core.async/commit/2f87bc7c7d10cb7b0baafc86e08489d58fa87424 since core.async 0.3.442
it's probably safer @d.eltzner to update clojure.core.async alone, rather than risk changing the figwheel/piggieback deps
you can normally only have one version of a dep, so you can make them use a newer one
Yup it was figwheel then. I don't quite get how I would "update core.async alone" though if it's a transitive dependency
the deps are depth-first, so be sure to add it before anything that uses it transitively in the list