This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-03-05
Channels
- # announcements (17)
- # aws (1)
- # babashka (68)
- # beginners (88)
- # calva (85)
- # chlorine-clover (10)
- # cider (5)
- # cljsrn (4)
- # clojure (99)
- # clojure-android (1)
- # clojure-denmark (1)
- # clojure-europe (15)
- # clojure-italy (5)
- # clojure-nl (3)
- # clojure-spec (1)
- # clojure-uk (67)
- # clojurescript (44)
- # core-async (44)
- # cryogen (4)
- # cursive (22)
- # data-science (2)
- # datascript (10)
- # datomic (29)
- # duct (11)
- # editors (2)
- # emacs (2)
- # events (1)
- # fulcro (28)
- # ghostwheel (7)
- # graalvm (8)
- # instaparse (6)
- # java (34)
- # jobs (9)
- # jobs-discuss (71)
- # juxt (12)
- # luminus (3)
- # malli (15)
- # meander (9)
- # nrepl (4)
- # off-topic (44)
- # pathom (13)
- # reagent (22)
- # schema (1)
- # shadow-cljs (39)
- # spacemacs (2)
- # test-check (1)
- # tree-sitter (5)
- # xtdb (5)
- # yada (1)
Hi, I'm having some issues with resolving dependencies. Maybe this is common?
I have 2 Libraries, A and B, And 1 application, C.
A is required by B, B is required by C. A's classpath doesn't get added to application C. Resulting in the following error:
Could not locate A/core__init.class
I can resolve this by adding A to C's project.clj
dependencies. However C isn't using A directly, so it doesn't make sense to me that I have to add A. Any ideas?
Is A a "provided" dependency of B? Also lein deps :tree
may give some hints as to what's going on.
It's not provided, it's a direct dependency. I tried to also include it in provided but both didn't work. Could be related to the fact that B is a private repo included through git
Hmm yeah I'm not familiar with git-down but a brief scan of docs suggests that it effectively means that B is being physically included in the source for C? If so, how are the dependencies for B being included?
i.e. is it possible that leiningen just isn't processing the project.clj
for B at all? (In which case, none of the transitive dependencies - including those of A - would be loaded.)
Yeah that's what I'm suspecting. I'm pretty sure this is a git-down related issue. I'll have to look more into that. Thanks
Are you using Leiningen? something else?
Is B published somewhere publicly, like Maven central or Clojars, or is it something private to you and/or your organization?
Reading again, you mention a project.clj
file, so that means yes for your using Leiningen. Perhaps however B was published as a JAR file does not correctly define A as something that B depends upon?
A is public, B is private organization repo that we include through git-down. Maybe that's the problem.
Hello, everyone. I'm looking for a mate who can help me on my business. I'm willing to pay monthly. Budget would be 500 ~ 2000USD. Please DM me. Thank you.
getting a dependency exception like this when trying to include clojupyter in my project
Caused by: clojure.lang.ExceptionInfo: Insufficient `com.taoensso/encore` version, you may have a dependency conflict: see for solutions. {:min-version "2.105.0", :your-version "2.91.0"}
at taoensso.encore$assert_min_encore_version.invokeStatic(encore.clj:1007)
at taoensso.encore$assert_min_encore_version.invoke(encore.clj:998)
is there a standard way to resolve issues like this using clj deps? The naive solution of just adding com.taoensso/encore {:mvn/version 2.105.0}
to deps.edn doesn't seem to be workingyou need quotes around 2.105.0
can you share full deps.edn and your output
"doesn't work" is not useful
is that commented line what you were trying? if so, that's not correct deps.edn syntax
override-deps only go in aliases, but I think you actually want that in your normal deps so it overrides the transitive version
so just include com.taoensso/encore {:mvn/version "2.119.0"}
in your :deps
in case anyone finds this via google the correct answer in exclude sente as it appears to be incompatible with clojupyter https://gist.github.com/vxe/e30fe65c78802bc746ce24857be616a0#file-gistfile1-txt-L1
Is the a good log analysis library in Clojure? I need to extract structured info from unstructured log lines. RegEx is helpful, but I also need to maintain context from previous line. For example, 1) Starting upgrade of node X 2) Container A upgraded successfully 3) Container B upgrade failed Now I need to output, {:node "X" :success ["A"] :failure ["B"]} What would be your approach to this?
well I don't really have any good ideas sorry. if it were me I'd be tempted to look at instaparse
My inclination would be to look into using Instaparse to write a parser that will convert each individual log entry into a useful hashmap, and then run some kind of aggregator function over all the hashmaps.
Hello. I'm continuing digging deeper into Clojure and I don't quite understand definterface
from official documentation. Could you give some more examples please?
Perhaps the examples from clojuredocs help? http://clojuredocs.org/clojure.core/definterface
yeah. I saw. I don't understand them.
Nope. I came from Haskell. I'm looking for a way to specify function's return (type?). Spec is basiclly for checking the argument themself.
It seems like definterface
"acts" on Records
Is there any way to to that?
Like: saying what expected from function to be result. And if it's not what's exprcted — throw and error with an explanation.
Or I can have the same by using spec inside the function's body? :thinking_face:
sorry got distracted. you'll need to read up on and understand java interfaces to understand definterface
My patters of thinking are somewhat locked on static type systems...
Ok. Thanks you.
typeclass, that's it. an interface is java's equivalent of a typeclass. but of course much more limited/less static than haskell
as an aside: in 10ish years of using clojure I don't think I've ever used definterface
It will be needed though when you want Java developers to also use your Clojure library.
(require '[clojure.datafy :as d])
(require '[clojure.core.protocols :as p])
(defrecord D [a b]
p/Datafiable
(d/datafy [this]
(-> (into {}
(map (fn [[k v]] [k (if (instance? D v) '=> v)]))
this)
(assoc :type "D")))
p/Navigable
(d/nav [this k v]
(get this k)))
I am wondering why the following doesn't let me see the nested D's in REBL. (D. 1 (D. 2 (D. 3 5)))
Is it possible to require different namespace depending on your build? Like if I want to build :a with lein it will require namespace foo, but if I build :b it will require namespace bar?
it's possible, I can't think of a situation where I'd recommend it. what's brought this about?
my first reaction is "create a protocol/multimethod and inject the dependency instead" btw
In the case of CLJS with React Native and React. I would like to abstract the UI layer and have different implementations of component depending on the target.
yeah a protocol/multimethod/passed-in-function is the appropriate way to create an abstraction, not namespaces
In this case the build should be passed to all functions?
Or you would initiate the closures at the beginning of the programs?
I would build your protocol implementing or multimethod dispatching object at whatever time you first know which to choose (which is probably start up) and then pass it down through each function as a parameter
hey! I am trying to build an app with overtone + reagent+ figwheel + ajax , but I am having lots of troubles with dependencies. Is anybody interesting in maybe generating a template for building this kind of apps? or just wanna help me with this particular project 🙂 ?
what command did you run from the command line to create the project?
I tried to start building by myself, but have problems connecting my server with clojurescript/figwheel server
so i run lein new reagent-ajax ...
which has a nice template, but dependencies are killing me
i tried to fix it with lein tree :deps
but did not work
> which has a nice template, but dependencies are killing me @mssarratea Did you try with Shadow-CLJS instead Lein/Figwheel ? For me when I begin last year, it was more clear and simplier.
I did not figure out how to set the server port, so to connect it with my backend clojure app
have you been through the same? can I see your code 🙃
Do you tried to communicate with your Clojure backend with AJAX from CLJS Reagent right ? Any information about your backend ? REST API ? Another ?
lein new re-frame is a nice template, might be worth doing that to get reagent/shadowcljs setup then remove re-frame if not needed
Say I want to return a value in a certain scenario, but just log an error and return nil (log function just returns nil) in another, is this weird?
(if good?
val
(log-err "No good!))
How would you tranform
{:x [1 2 3]
:y [4 5 6]}
into
[{:x 1 :y 4}
{:x 2 :y 5}
{:x 3 :y 6}]
Multi-arity map
:
(let [old-data {:x [1 2 3]
:y [4 5 6]}]
(map (fn [x y]
{:x x :y y})
(:x old-data)
(:y old-data)))
;; => ({:x 1, :y 4} {:x 2, :y 5} {:x 3, :y 6})
ya, use map, it allows to take multiple sequences as arguments
something like
(let [{:keys [x y]} input]
(into [] (map (fn [xval yval] {:x xval :y yval}) x y)))
I'm trying to have this work for arbitrary keys, but guaranteed values have the same number of elements, I've got this far, missing
:ab
(def m {:x [1 2 3]
:y [4 5 6]
:z [7 8 9]
:ab [10 11 12]})
(let [ks (keys m)
vs (vals m)]
(map #(zipmap ks %) vs)
)
and I forgot the &
(let [ks (keys m)]
(into [] (apply map #(zipmap ks %&) (vals m))))
[{:x 1, :y 4, :z 7, :ab 10} {:x 2, :y 5, :z 8, :ab 11} {:x 3, :y 6, :z 9, :ab 12}]