beginners

SΓΈren 2026-04-10T08:56:32.446419Z

Hey! I'm using CIDER in Emacs. I've only just created smaller hobby-projects in cljoure. cider-jack-in works great. Now I want to do a bit of a bigger project, and I'd like to use some of the debugger tools and data-browsers (`morse` , flowstorm). I can add them to my deps.edn under a :dev alias and start my REPL with clj -A:my-alias in my terminal just fine. But: How do I start my cider nrepl from Emacs with a specific alias? What is the normal way to approach this? Start an nrepl in the terminal and connect to it? It would be nice to just handle everything from emacs. (I'm using Doom Emacs, if that matters).

olli 2026-04-10T09:08:19.819819Z

I'm using vanilla Emacs and Leiningen so not exactly sure about Doom and deps.edn specifically, but according to the docs you'd do that by customizing the variable cider-clojure-cli-parameters``, while for me, with Leiningen, it's cider-lein-parameters`` https://docs.cider.mx/cider/basics/up_and_running.html

SΓΈren 2026-04-10T09:10:27.267229Z

I got some help over at #emacs as well. I'm now just setting a .dir-locals.el file that sets the cider-clojure-cli-aliases variable to the thing i want. It works!

πŸ™Œ 1
olli 2026-04-10T09:10:32.841139Z

Or perhaps cider-clojure-cli-aliases now that I read your question again and you seem to be using an alias

olli 2026-04-10T09:10:34.252139Z

Yeah

πŸ€™ 1
daveliepmann 2026-04-10T17:49:05.415039Z

according to this interaction in #cider you can also pass a prefix argument to jack-in https://clojurians.slack.com/archives/C0617A8PQ/p1568144401230400

πŸ‘Œ 1
Anthony Franco 2026-04-10T17:41:30.752869Z

Is there a good canonical example of an API wrapper (like an HTTP API) written in Clojure and released on Clojars? I'm looking for what Clojurists tend to prefer in ergonomics rather than just my own personal preference. Bonus points for having a Java/JVM reverse interop story (I'm not well-versed with that ecosystem either, so it'd be nice to see "Here's how to use it in Java and get it with maven" etc)

2026-04-10T17:43:04.000189Z

i don't think there's anything that's "canonical", as it all depends on the desires of the person writing the wrapper

2026-04-10T17:44:49.264959Z

For example, #cljfx is a wrapper around javafx, but it's got a whole DSL attached, and does a fair amount to smooth over the rough edges of javafx. i wrote https://github.com/NoahTheDuke/fluent-clj/ to wrap java and javascript Project Fluent libraries, and i expose a very minimal api (much less than the originating libraries) because I personally only needed a small surface area

Samuel Ludwig 2026-04-10T17:45:19.608969Z

I actually think seancorfield's HoneySQL is a very nice example of 'clojures cultural ergonomics' when compared to your typical ORM/query-builder https://github.com/seancorfield/honeysql

seancorfield 2026-04-10T17:46:04.736509Z

It really depends on what the API being wrapped looks like. For example, a Java API that is heavily reliant on the "builder" pattern is not very nice to use via interop from Clojure really, so when folks wrap those, they often adopt a data-first approach: you give the Clojure wrapper a hash map, and it deals with the repeated calls to builder methods under the hood. org.clojure/java.data is a generic example of that: mapping hash maps (and a class name) to a fully populated Java object and back again.

βž• 1
2026-04-10T17:46:37.970019Z

oh yeah, i forgot about java.data, that's a good one

seancorfield 2026-04-10T17:49:15.094919Z

Sometimes, just generating a Clojure ns full of functions to wrap Java classes and methods is enough to make something more usable, taking care of mapping from plain Clojure vectors and hash maps to Java objects and back. But the generated code is often horrible. Hand-writing such a wrapper can produce better code but is a giant, tedious, PITA. clj-time (deprecated) is a good example of the latter, I'd say. Very thin wrapper.

seancorfield 2026-04-10T17:50:49.263049Z

next.jdbc is also a fairly thin, hand-written wrapper (around JDBC) and it presents a fairly simple, idiomatic Clojure API. So that might be another project to look at. HoneySQL isn't an API wrapper per se, except insofar as it wraps SQL generation so you can avoid string bashing πŸ™‚

βž• 1
Samuel Ludwig 2026-04-10T17:53:30.211329Z

What is SQL (the language) if not the API to SQL (the database) πŸ˜„

seancorfield 2026-04-10T18:13:55.495029Z

@anthonykfranco Just noticed your edit about invoking the Clojure API from Java -- you won't find much of that. The expectation (in the Java world) is just to use those APIs directly, and any such SDKs tend to expose idiomatic Java APIs. Calling a Clojure API wrapper from Java is likely to be non-idiomatic for Java developers, and also generally requires the Clojure API wrapper to provide an AOT-compiled ns to act as a Java class for Java developers to instantiate and use. In addition, most Clojure libraries are published to Clojars, not Maven Central, so that would also be an extra complexity for Java developers.

seancorfield 2026-04-10T18:15:44.598899Z

Without that AOT-compiled shim, your Java devs would have to follow this https://clojure.org/reference/java_interop#_calling_clojure_from_java which would be even less idiomatic for them, I suspect πŸ™‚

Anthony Franco 2026-04-10T18:18:54.940879Z

@seancorfield I was thinking more so along the lines of remote HTTP API's, like say if servicedotcom released a public API for a few CRUD-style things, the ergonomics that a Clojurist would expect for a library wrapping it to feel idiomatic. And then regarding Java interop, I mean an example of using the published Clojure library from Java code (so that the Clojure library could end up being the canonical wrapping library for the JVM ecosystem as a whole)

seancorfield 2026-04-10T18:37:35.110879Z

Right, but an idiomatic Clojure API for that service is not going to be idiomatic for Java developers -- and that usage would add a lot of complexity around making it callable from Java and explaining how Java developers should depend on it from Clojars etc etc.

seancorfield 2026-04-10T18:40:07.515879Z

An idiomatic Clojure wrapper is probably going to involve passing and returning Clojure's immutable hash maps, for a start, whereas an idiomatic Java wrapper would likely have dedicated input and output classes, probably with a builder API for the input classes.

seancorfield 2026-04-10T18:43:04.837869Z

Those idiomatic Clojure hash maps would have keywords as keys. Java maps usually have strings as keys. Etc.

Anthony Franco 2026-04-10T18:44:43.297259Z

I see, so when I said bonus points, I really meant it. The data structures themselves would not feel right in Java

seancorfield 2026-04-10T18:48:17.210759Z

At work, we interact with a lot of remote HTTP APIs. We mostly use Hato (a Clojure wrapper for Java's built-in HTTP client) and very little else, i.e., we tend to use the APIs directly -- because a wrapper is rarely even worthwhile, assuming it accepts and returns JSON. We just use org.clojure/data.json (no dependencies) to encode the parameters and decode the response body. We have a thin, generic wrapper for Hato that handles JSON in/out, just to remove a bit of boilerplate.

seancorfield 2026-04-10T18:50:13.165969Z

I'm working with an HTTP API right now that accepts plain old form POSTs and returns (flat) XML, so I've written a very thin custom wrapper that accepts hash maps (which Hato's form POST handles just fine) and parses the returned XML into a hash map. But even that's pretty generic.

Anthony Franco 2026-04-10T18:50:55.354479Z

That makes a lot of sense to me. No need to reinvent the wheel if it's simple enough not to. Is there something flat like that for GraphQL?

seancorfield 2026-04-10T19:01:13.645719Z

No idea. I hate GraphQL. We implemented it for one of our own APIs (and our own app as a client) and it was horribly complicated. We'd never use it again.