This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-08-20
Channels
- # announcements (16)
- # babashka (71)
- # beginners (121)
- # bristol-clojurians (2)
- # calva (55)
- # clj-kondo (16)
- # clojure (103)
- # clojure-europe (9)
- # clojure-italy (5)
- # clojure-nl (4)
- # clojure-spec (49)
- # clojure-uk (57)
- # clojurescript (28)
- # conjure (9)
- # cursive (6)
- # datascript (3)
- # datomic (35)
- # duct (20)
- # events (3)
- # figwheel-main (12)
- # fulcro (6)
- # graalvm (12)
- # juxt (3)
- # kaocha (5)
- # lumo (10)
- # malli (5)
- # off-topic (54)
- # pathom (8)
- # re-frame (19)
- # reitit (21)
- # remote-jobs (1)
- # shadow-cljs (102)
- # sql (38)
- # tools-deps (60)
- # uncomplicate (3)
- # xtdb (10)
Is there anyway to get a release for this issue? https://clojure.atlassian.net/browse/DIMAP-15. It looks like the fix is https://github.com/clojure/data.int-map/commits/master but there’s been no release for ~3 years.
Hmm, no release for 4 years -- and this (and DIMAP-14) were fixed 3 years ago. I looked at https://clojure.org/community/contrib_libs but it's not even listed there so I don't even know what its status is supposed to be at this point @kenny 😐
added, I'd say it's stable, should be working fine
fyi, that data int map link goes to https://clojure.github.io/data.int-map/ which is a 404.
yeah, the docs need to be gen'ed for it
it should be a link :)
I don't have permission to cut a release on http://build.clojure.org otherwise I'd be happy to update the readme/changelog etc and put a release out. @alexmiller is anyone considered a maintainer for this lib these days?
That’d be awesome if you’d be able to! We can work around this internally too. Just seems sad to have the latest version be broken in a pretty bad way.
I just tried to run mvn test
locally and it doesn't build/run...
It doesn't seem to build/run on the CI box tho'...
Ah, it needs pom.xml
updating for the parent pom.
Why’d it stop working? If everything referred to immutable artifacts, I’d think it would work “until the end of time”
The build environment overrides some stuff that you don't have in the local env.
So the parent pom version is likely overridden, I suspect that's all it is.
I think it's just the jenkins jobs that need to be refreshed, I'll take a look
it's not the parent pom, this was due to the default Clojure version that was used during compile - we only build/test with clojure 1.7+ now
ok, org.clojure/data.int-map 1.0.0 is out there now. I closed the DIMAP-14 and DIMAP-15 tickets
Thank you Alex!
@alexmiller FWIW, when I first tried to build it tonight, it failed with
[INFO] --- maven-compiler-plugin:3.6.0:compile (default-compile) @ data.int-map ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 4 source files to /Developer/clojure/data.int-map/target/classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] Source option 6 is no longer supported. Use 7 or later.
[ERROR] Target option 6 is no longer supported. Use 7 or later.
[INFO] 2 errors
so I updated the parent pom version from 0.2.2
to 1.0.0
here
<parent>
<groupId>org.clojure</groupId>
<artifactId>pom.contrib</artifactId>
<version>0.2.2</version>
</parent>
and then mvn test
ran just fine. After you did the release, that has 1.0.0
and it builds/runs/locally just fine. And that was one of the changes you made https://github.com/clojure/data.int-map/commit/f3febf5d3ac0632f58bb9623d99c41a562aafebf before the release.(I didn't touch the clojure.version
in my copy when I updated the parent pom -- so that's why I said it was the parent pom)
Hi Clojurians! My company, Evident Systems, just launched a product written in Clojure and especially ClojureScript called oNote https://onote.com/. oNote is an Event Modeling (https://eventmodeling.org/) platform to help software teams design, implement, and operate simpler systems. It’s still very early, but I’d really appreciate any feedback from the Clojure community either in a thread off this message, or in DM to me. Thanks!
Is it possible to create an account with email?
It seems macros silently fail at expansion. I’ve had some experiences of macros not existing because of a var not existing. Tbh I’m not sure why they fail. Is this a known issue? I’m currently working with cross platform macros so this is both a Clojure and clojurescript question. I think one place I tripped up on recently was self requiring the namespace with :require-macros. If I miss a macro that is actually used inside of another macro. Everything seemed to compile without error or warning. Would appreciate any material or references for learning more deeply about Clojure macros.
I found this to be a great material, if a bit entry-level: https://www.braveclojure.com/writing-macros/
@U2FRKM4TW that is always my first point of reference when looking for a bit more guidance 🙂
@U3Y18N0UC knows some good resource?
@U05095F2K this will probably help you a lot: https://code.thheller.com/blog/shadow-cljs/2019/10/12/clojurescript-macros.html That's how I found out how to write good macros in ClojureScript.
Also, if you're not using it yet, I really recommend shadow-cljs for ClojureScript. In the past, I had lots of problems with "code is compiling but things fail", but I almost never see it anymore with Shadow-CLJS
I use shadow. I have seen this post several times I do check it from time to time. I am hoping for a deeper dive but I guess most of that would come from actually delving more into the compiler
I believe the best way to debug it is to print the result of macroexpand-1
.
On ClojureScript, I believe that it'll print in the same console as shadow-cljs' watch process
The problem I had was that I wasn’t aware that macros failed until way later. Once I knew they failed it was easy to debug them. But I didn’t get any warnings that a macro was using a function that wasn’t available for example.
It's more or less the same if you wrote some incorrect code in an NS and then loaded that NS with a call to (require ...)
in runtime.
Maybe it's possible to guard against such things, I don't know.
yes perhaps the way I phrased it was incorrect. I’m somewhat leaning towards having a convention of running a test on macros.
Hi Clojurians, I hope this question isn’t too silly, but I'm getting nowhere here. I got this xml:
(def xml-text "<text>abc<p>defgh<hi>ij</hi>klmn</p><p>opqrs</p></text>")
(def xml-doc (-> xml-text .getBytes java.io.ByteArrayInputStream. parse))
Which results in this:
{:tag :text,
:attrs {},
:content
("abc"
{:tag :p,
:attrs {},
:content ("defgh" {:tag :hi, :attrs {}, :content ("ij")} "klmn")}
{:tag :p, :attrs {}, :content ("opqrs")})}
I need to construct the following output:
("abc" "defgh" "ij" "klmn" "opqrs")
I’ve tried
(for [x (xml-seq xml-doc)] (first (:content x)))
But i only get
("abc" nil "defgh" nil "ij" nil nil "opqrs" nil)
„klmn“ is missing here. Because it’s outside of the :content ?
Thanks for your help.well you're doing first
- that's ignoring the rest of the child content
content is a vector or sequence of children and "klmn" is the second text node
But how to get the second node to be attached to the list?
call second
?
I wouldn't use for
to do this
if you want to look at all nodes, you could do something like (mapcat :content (xml-seq xml-doc))
and then filter the nils:
(->> xml-doc xml-seq (mapcat :content) (remove nil?))
you can use tree-seq
- it's generic
but xml-seq
is that basically
yeah that's what i was thinking of. figured there was one that knew what branches and children were
@alexmiller I've tried it, but I can't figure it out
(->> xml-doc xml-seq (mapcat :content) (remove nil?))
("abc"
{:tag :p,
:attrs {},
:content ("defgh" {:tag :hi, :attrs {}, :content ("ij")} "klmn")}
{:tag :p, :attrs {}, :content ("opqrs")}
"defgh"
{:tag :hi, :attrs {}, :content ("ij")}
"klmn"
"ij"
"opqrs")
Sorry I'm a beginner with Clojure
I've found this one http://josf.info/blog/2014/10/02/practical-zippers-extracting-text-with-enlive/ Not the path I wanted to take, but this is how I get ahead. Thanks for your help.
I’m not sure why I find myself advocating XPath and XSLT so much recently, but with XPath, you could just do something like this:
λ clj -Sdeps '{:deps {me.flowthing/sigel {:mvn/version "1.0.0"}}}'
Clojure 1.10.1
user=> (require '[sigel.xpath.core :as xpath])
nil
user=> (map str (xpath/select "<text>abc<p>defgh<hi>ij</hi>klmn</p><p>opqrs</p></text>" "//text()"))
("abc" "defgh" "ij" "klmn" "opqrs")
FWIW it seems like at the point you got to w/ the suggestions here, you could filter out the non-string values and be done?
?Hey guys, could anyone help me out with calling Clojure from Java interop. Mainly, how would i import the ManyToManyChannels class from core.async that is defined using deftype into my Java class??
you probably shouldn't use that class directly, but you would just import it like any Java class
So i'm importing like this
import clojure.core.async.impl.channels.ManyToManyChannel;
I guess you would need a compiled version of core.async for that to work
And my IDE also recognizes it (using Cursive/Intellij)
what are you going to do with it?
you might want to use the Clojure Java API (https://clojure.github.io/clojure/javadoc/)
https://clojure.github.io/clojure/javadoc/clojure/java/api/package-summary.html has some example stuff
I'm creating a DSL using clojure, but i want to give to the user some kind of Java API as well. I want to create a Base implementation of a class that will have methods which will receive clojure objects and that base implementation will translate those to Java POJOs which in turn will be passed to the interface methods that the user has to implement.
I can import other classes like PersistentArrayMap
and then convert it to a Java POJO no problem
But PersistentArrayMap has been defined in Java in clojure.core while classes like ManyToManyChannel are defiined using deftype
i can find many sources for Clojure calling java, that's no problem. But not many for Java calling clojure except the few stuff that's on their main website.
I guess i'll just use Object instead
my standard advice for this is to: 1. define the Java API you want using Java interfaces - this can have precise types, javadoc, etc 2. implement the Java API using Clojure 3. use the Clojure Java API to implement the factory "hook" that gives Java users the impl
https://github.com/puredanger/clojure-from-java is an example (maybe not the best impl example, but follows this pattern)
Yes this is what i would usually do, but this scenario is different and i'm having difficulty explaining.
Sorry.
Thanks for the help anyways
those deftype classes don't exist until you load those namespaces
so either they need to be AOT compiled and available or you need to use Clojure enough to load the namespace and have the side effect of loading those deftype classes dynamically. if you need the actual class reference in Java (for a type-based check for example, then you have to AOT)
Hmmm, so but if i have a clojure/java lein project (as i currently do) how do i AOT dependencies (like core.async)?
well, it depends a bit. but you could probably :aot :all
Yeah, i do that already.
I guess it doesn't matter anyways
I resorted to doing
IFn put_Bang = Clojure.var("clojure.core.async", "put!");
put_Bang.invoke(this.channel, this.barToClojureMap(bar));
where this.channel is of type Object
this is hidden from the user anyways
yeah, the type is truly not important anyways here - IFn.invoke takes Objects
the whole "dynamically typed" thing
Thanks for the help, much appreciated
Hi everyone, it seems that destructuring doesn't work in macros. Wondering if there is a workaround. Thanks! 🙏