beginners

Getting started with Clojure/ClojureScript? Welcome! Also try: https://ask.clojure.org. Check out resources at https://gist.github.com/yogthos/be323be0361c589570a6da4ccc85f58f.
2021-02-27T00:50:52.460900Z

How about:

(-> {:foo "ab" :bar "cd"}
    vals
    reverse)

seancorfield 2021-02-27T00:59:48.461100Z

Hash maps are inherently unordered. You can't rely on the ordering or the reverse ordering.

seancorfield 2021-02-27T01:00:18.461300Z

And I think the assumption is that there are many other keys in there, but @david.daigml only wants two of them.

2021-02-27T01:01:33.461500Z

Yes. map is unordered. You are right.

John Doneth 2021-02-27T01:49:17.461800Z

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)

2021-02-27T01:51:52.462400Z

It looks like it is a package private class

John Doneth 2021-02-27T01:53:36.463100Z

How can you tell it's only private to the package? I see the public attribute on the constructor

John Doneth 2021-02-27T01:54:28.463300Z

Oh does the class declaration itself needs the public modifier? It's been a while since I used Java itself

2021-02-27T01:59:00.463500Z

Me too, but yes I believe the class needs the modifier as well

phronmophobic 2021-02-27T02:00:02.463700Z

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)

phronmophobic 2021-02-27T02:00:13.463900Z

see also https://github.com/java-native-access/jna/blob/master/www/Mappings.md

popeye 2021-02-27T07:44:01.466700Z

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

javahippie 2021-02-27T08:36:34.467200Z

@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

javahippie 2021-02-27T08:37:50.467900Z

javahippie 2021-02-27T08:38:08.468Z

You can create and start a container prior to your testrun. It will shutdown automatically when the JVM exits

Hagenek 2021-02-27T09:57:27.469600Z

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? 😃

2021-03-01T03:35:25.014400Z

ORM hater here. Try this sql library http://walkable.gitlab.io :))

borkdude 2021-02-27T10:09:08.471100Z

@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).

1
Hagenek 2021-02-27T10:18:43.471800Z

Great! Thanks, thats enough to get me started 😃

naxels 2021-02-27T11:43:10.475400Z

Good day everyone

naxels 2021-02-27T11:43:22.475800Z

In VSCode while using Calva / lsp / clj-kondo under the hood

naxels 2021-02-27T11:43:41.476200Z

when I tried to parse XML using the clojure.data.xml library

naxels 2021-02-27T11:43:48.476500Z

and do as the github page suggests for namespacing:

naxels 2021-02-27T11:43:57.476800Z

;; <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:

naxels 2021-02-27T11:44:11.477200Z

I receive a message from clj-kondo when actually applying this:

naxels 2021-02-27T11:44:28.477600Z

(alias-uri 'xh "<http://xml.weather.yahoo.com/ns/rss/1.0>")

naxels 2021-02-27T11:44:35.477900Z

:when (= ::xh/location (:tag x))]

naxels 2021-02-27T11:44:47.478200Z

the message: Unresolved namespace xh. Are you missing a require?

naxels 2021-02-27T11:45:14.478800Z

How can I resolve this?

naxels 2021-02-27T11:45:19.479100Z

found this: https://github.com/clj-kondo/clj-kondo/issues/1156

borkdude 2021-02-27T11:45:57.479700Z

@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

naxels 2021-02-27T11:46:37.480Z

Hi Michiel, sure

naxels 2021-02-27T11:51:12.480200Z

how do you want the file?

naxels 2021-02-27T11:51:46.480700Z

it’s 1 resource file and 1 clj file, deps.edn is just clojure & clojure.data.xml

naxels 2021-02-27T11:52:28.481Z

although for clj-kondo you likely won’t need the .xml file in resources

borkdude 2021-02-27T11:52:58.481300Z

just the .clj file would be fine, clj-kondo doesn't care about your deps, you can just throw some code at it

naxels 2021-02-27T11:53:24.481500Z

naxels 2021-02-27T11:55:27.481900Z

@borkdude, if it’s easier, I also have a github link to the file

borkdude 2021-02-27T12:03:08.483100Z

@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.

naxels 2021-02-27T12:04:56.483300Z

understood, thanks

naxels 2021-02-27T12:05:03.483600Z

i was hoping it was my inexperience that was the problem haha

borkdude 2021-02-27T12:10:50.483800Z

it's clj-kondo's inexperience :)

naxels 2021-02-27T12:11:42.484Z

haha

naxels 2021-02-27T12:11:48.484200Z

you want an Issue or Feature request?

borkdude 2021-02-27T12:15:02.484500Z

either way is fine

naxels 2021-02-27T12:21:57.484700Z

Thanks! it’s posted

naxels 2021-02-27T12:22:14.485100Z

Keep up the good work on the tool, really like having it watching over my shoulder

naxels 2021-02-27T12:22:19.485300Z

Enjoy your weekend

🎉 1
pez 2021-02-27T15:05:00.487Z

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

👍 1
❤️ 3
borkdude 2021-02-27T15:52:13.487200Z

Why is it called Dram? This means "whine" in Dutch ;)

pez 2021-02-27T15:59:12.487400Z

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.

borkdude 2021-02-27T15:59:31.487600Z

I see

pez 2021-02-27T16:00:20.487800Z

It’s a reference to Calva, I guess.

borkdude 2021-02-27T16:00:30.488Z

:thumbsup:

borkdude 2021-02-27T16:00:48.488200Z

So you are creating a community of alcohol lovers. Nice direction ;)

pez 2021-02-27T16:01:08.488400Z

@bozhidar started it!

2
pez 2021-02-27T16:02:46.488600Z

And there’s rum , which needs citrus and more of these. I know @pedrorgirardi dislikes this a bit. Haha.

2021-02-27T16:29:58.489Z

Need more clojure named after Scottish alcoholic beverages!

1
pez 2021-02-27T16:34:03.489300Z

Yeah, where’s Lagavulin, the smoke testing library?

bozhidar 2021-02-27T16:39:52.489600Z

I've been wondering about this myself! 😄

pez 2021-02-27T16:42:50.489800Z

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.