How about:
(-> {:foo "ab" :bar "cd"}
vals
reverse)
Hash maps are inherently unordered. You can't rely on the ordering or the reverse ordering.
And I think the assumption is that there are many other keys in there, but @david.daigml only wants two of them.
Yes. map is unordered. You are right.
If someone could help me make heads or tails of this error, that would be amazing. For some reason I can't invoke the constructor of this Java class without an exception being raised.
project.main=> (new com.sun.jna.NativeString "")
Execution error (IllegalAccessError) at project.main/eval2183 (form-init10170902368369356528.clj:1).
failed to access class com.sun.jna.NativeString from class project.main$eval2183 (com.sun.jna.NativeString is in unnamed module of loader 'app'; project.main$eval2183 is in unnamed module of loader clojure.lang.DynamicClassLoader @576d3dca)
It looks like it is a package private class
https://github.com/java-native-access/jna/blob/master/src/com/sun/jna/NativeString.java#L32 no public modifier
How can you tell it's only private to the package? I see the public attribute on the constructor
Oh does the class
declaration itself needs the public modifier? It's been a while since I used Java itself
Me too, but yes I believe the class needs the modifier as well
specifically for jna, you typically don't use NativeString, you typically either: • pass a java.lang.String (which gets converted to a c string) • pass a https://java-native-access.github.io/jna/4.2.1/com/sun/jna/WString.html (which gets converted to a wide string) • or pass a https://java-native-access.github.io/jna/4.2.0/com/sun/jna/Memory.html whose bytes you fill yourself (which gets passed a pointer)
see also https://github.com/java-native-access/jna/blob/master/www/Mappings.md
I have an application that, my test cases depends on the docker container up, Before running clojure testc ases I need to start docker so that container is available, Is there any good doc of integration of test cases docker for clojure
@popeyepwr A little self promotion, I maintain a Clojure wrapper for Testcontainers a Java library orchestrating Docker containers for test cases.: https://github.com/javahippie/clj-test-containers This could maybe help you
You can create and start a container prior to your testrun. It will shutdown automatically when the JVM exits
Hi, everyone. Hope you are having a nice Saturday. I have given myself a small project today, create a clojure program that reads and writes to a PostgreSQL databse (without ORM). Anyone know of a good place to start? 😃
ORM hater here. Try this sql library http://walkable.gitlab.io :))
@georghagen If you want to use the regular Clojure on the JVM, I recommend the honeysql library, next.jdbc + the postgresql JDBC driver. You can also use babashka and the postgresql pod for instant startup. https://github.com/babashka/babashka-sql-pods/#run You can also use the honeysql library with this (see further along in the README).
Great! Thanks, thats enough to get me started 😃
Good day everyone
In VSCode while using Calva / lsp / clj-kondo under the hood
when I tried to parse XML using the clojure.data.xml library
and do as the github page suggests for namespacing:
;; <https://github.com/clojure/data.xml#namespace-support>
;; Emitting namespaced XML is usually done by using alias-uri
;; in combination with clojure's built-in ::kw-ns/shorthands:
I receive a message from clj-kondo when actually applying this:
(alias-uri 'xh "<http://xml.weather.yahoo.com/ns/rss/1.0>")
:when (= ::xh/location (:tag x))]
the message: Unresolved namespace xh. Are you missing a require?
How can I resolve this?
found this: https://github.com/clj-kondo/clj-kondo/issues/1156
@patrick.glind I think you can fix this using a clj-kondo config. Please provide a full minimal standalone repro of your code which I can execute with clj-kondo --lint example.clj
Hi Michiel, sure
how do you want the file?
it’s 1 resource file and 1 clj file, deps.edn is just clojure & clojure.data.xml
although for clj-kondo you likely won’t need the .xml file in resources
just the .clj file would be fine, clj-kondo doesn't care about your deps, you can just throw some code at it
@borkdude, if it’s easier, I also have a github link to the file
@patrick.glind I think it's best to post an issue about this at the clj-kondo repo. I'll fix it in the next release of clj-kondo. For now you can write:
:when #_:clj-kondo/ignore
(= ::xh/location (:tag x))
to ignore this warning. Clj-kondo just doesn't understand the alias-uri
macro.understood, thanks
i was hoping it was my inexperience that was the problem haha
it's clj-kondo's inexperience :)
haha
you want an Issue or Feature request?
either way is fine
Thanks! it’s posted
Keep up the good work on the tool, really like having it watching over my shoulder
Enjoy your weekend
Hello, I’d love myself some beginners and experts to try out an interactive beginners guide to Clojure that I am developing. Thanks in advance! ❤️ https://clojureverse.org/t/dram-is-an-interactive-beginners-clojure-guide-in-the-making/7268
Why is it called Dram? This means "whine" in Dutch ;)
The repo lists this definition: > dram > noun • mainly Scottish a small drink of whisky or other spirits: a wee dram to ward off the winter chill.
I see
It’s a reference to Calva, I guess.
:thumbsup:
So you are creating a community of alcohol lovers. Nice direction ;)
@bozhidar started it!
And there’s rum
, which needs citrus
and more of these. I know @pedrorgirardi dislikes this a bit. Haha.
Need more clojure named after Scottish alcoholic beverages!
Yeah, where’s Lagavulin, the smoke testing library?
I've been wondering about this myself! 😄
Many years ago me and my wife visited Scotland. We rented a car and drove (well she was the driver ) from distillery to distillery, learnt about whiskey making, and had drams (I had drams). I guess that’s why dram was close at hand for me in naming this project.