This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
I found something interesting just now https://youtu.be/RgF0hy6tEQs It's for datomic/datahike but is basically what I was looking for
I am using XTDB with GraphQL in a luminus app. In XTDB and clojure, it seems hyphens are conventionally used for multi-word identifiers. However, GraphQL doesn’t accept hyphens as field names. Conversion is of course possible but I thought it would impact performance when dealing with large datasets. So, as I see it, either I have to ditch XTDB/Clojure conventions and use unnamespaced identifiers with underscores (Instead of hyphens) or do the conversion. What do you guys typically do in such scenarios? Thanks.
Ditching hyphens in favour of underscores is fine. Personally I find it quite confusing when the keys are kebab-case-transformed back and forth. Just use underscores and don't worry about it.

Here's a https://clojureverse.org/t/clojures-keyword-namespacing-convention-considered-harmful/6169 about this.

the difference between - and is insignificant yet ones how transform the keys waste CPU for nothing and bring confusion. Say, you fetch a JSON from remote API expecting username but a "smart" HTTP client has transformed it to user-name silently
Mixing snake and kebab case can bring confusion to the programmer. Here's my N=1 on a project where the number of developers is also 1. My project has snake case on both input and output: java.jdbc when it talks to the database and a GraphQL schema when it communicates over HTTP. So I made the decision to leave its intermediate data manipulations in snake case. But I find that I frequently make mistakes where I type something in kebab when I should use snake, and have to track down the misnamed value. I think this happens just because in Clojure most things are kebab and my fingers type hyphens on autopilot because my brain is already thinking about the next line of code. So I've been getting increasingly tempted to use case conversion at input and output just to stop a whole class of bugs from happening. Just typing this paragraph has made me realise that doing so would have a pretty quick payback on investment when measured in programmer-hours

I find if you convert to a keyword, doing kebab case conversion is nice. If you don't want to convert, keeping it as a string key makes it clear it's a "foreign" key.

So I’m trying to use sqlite application defined functions: https://github.com/xerial/sqlite-jdbc/blob/master/src/main/java/org/sqlite/Function.java#L208 This involves extending org.sqlite.Function and overriding the xFunc method. This is trivial in something like groovy:
new Function() {
protected void xFunc() {
result("myFunc called!");
}
But i’m really struggling in Clojure. I’ve been down a :gen-class rabbit hole and I can’t for the life of me call the protected result
method:
(ns foo
(:gen-class
:extends org.sqlite.Function
:exposes-methods {result superResult}))
(defn -xFunc [this]
(.superResult this "myFunc called!"))
I keep getting no method result on class foo taking one arg found. What am I missing?So I’ve managed to do a bare bones project where I’ve got it working. So not quite sure what the issue was in my other project. :thinking_face: I’ll try and get it working in the main project now.
I'm trying to use add-lib
in 1.12.0-alpha4. What I'm doing wrong?
(ns user
(:require
[hashp.core]
[clojure.repl.deps :refer [add-lib add-libs]]))
(add-lib 'org.rssys/context {:mvn/version "0.1.4"})
Execution error (ExceptionInfo) at clojure.tools.deps.interop/invoke-tool (interop.clj:49).
null
*e
=>
#error{:cause nil,
:data {},
:via [{:type clojure.lang.ExceptionInfo,
:message nil,
:data {},
:at [clojure.tools.deps.interop$invoke_tool invokeStatic "interop.clj" 49]}],
:trace [[clojure.tools.deps.interop$invoke_tool invokeStatic "interop.clj" 49]
[clojure.tools.deps.interop$invoke_tool invoke "interop.clj" 15]
[clojure.repl.deps$add_libs invokeStatic "deps.clj" 48]
[clojure.repl.deps$add_lib invokeStatic "deps.clj" 57]
[clojure.repl.deps$add_lib invoke "deps.clj" 57]
[user$eval20397 invokeStatic "user.clj" 9]
[user$eval20397 invoke "user.clj" 9]
Do you have the latest clojure cli installed?
I'm pretty sure you need the latest, https://clojurians.slack.com/archives/C06E3HYPR/p1688132252176789
Thank you!
This is because alpha 4 passes the basis via stdin and that ability was only added in 1.11.1347 (in case you're curious).