Questions tagged [clojure]

Clojure is a modern Lisp dialect for the Java Virtual Machine (with versions for the CLR and JavaScript). More than merely an implementation of Lisp in Java, Clojure provides access to Java's classes and ecosystem.

clojure
Filter by
Sorted by
Tagged with
1 vote
0 answers
51 views

How can I include jar files for clojure in JNI inside a c++ binary created with bazel

Hello I am working on this project: https://github.com/svazqz/plClojure But currently I am facing an issue after building the c++ binary, when I run the file create after the build step I get: # # A ...
svazq's user avatar
  • 11
1 vote
1 answer
64 views

Error while upgrading the Clojure project from Java 8 to Java 17

When I did upgrade my Clojure project to OpenJDK 17, I am facing unusual exceptions. The get-object function of S3 expects two arguments which we were passing as map in format (s3/get-object :bucket-...
Praveen's user avatar
  • 11
1 vote
0 answers
55 views

Clojure test, how to test if a namespace is being used by another namespace

We have namespaces that are only used for older years, and have been improved for future years. And we want to test that these old namespaces are not required or accessible from future years We have ...
f1wade's user avatar
  • 2,907
0 votes
0 answers
57 views

Redundand queries to the `pg_catalog.pg_type` table

I'm using Next.JDBC with the official Postgres driver and HickaryCP pool. Every time I query something that involves JSONb, I see some extra queries in the console, like: SELECT n.nspname = ANY(...
Ivan Grishaev's user avatar
1 vote
2 answers
72 views

Safe declarative programming in Clojure?

I thought I had a smart idea. I want to make call-back functions for database calls. Usually, you would make something like: (defn on-doc-insert [ts doc] ; the call-back (do-something-with-doc doc)) ...
Lars Melander's user avatar
0 votes
1 answer
41 views

SSE implementation in Pedestal using individual channel per user

I am working on an application that used to use websockets but due to scaling issues with them, we decided to replace them with server-sent events (SSE). Our goal is to make it possible to create an ...
Rosen Hristov's user avatar
0 votes
1 answer
48 views

Within a Clojure project using deps.edn, where is the package name and version tracked?

Where would one track/store the package name and version string within a Clojure project using deps.edn? For example, within a Rust project, there is the Cargo.toml file where the package name and ...
justkash's user avatar
  • 669
0 votes
0 answers
79 views

How can I update and iterate the sub maps and update map into different location of map at the same time in clojure

I've below clojure object. {:openapi "3.0.3", :info {:title "Swagger API", :version "0.0.1"}, :paths {"/api" {:post {:parameters [{:in "query&...
user51's user avatar
  • 9,517
1 vote
2 answers
96 views

Out of memory in clojure - Nested reduce on Lazy Sequence

Something as simple as adding 3 nested reduce is giving me an out of memory error. Execution error (OutOfMemoryError) at .../my-large-lazy$iter$fn$fn$iter$fn$fn$iter$fn$fn (serial_write.clj:39). Java ...
Anita's user avatar
  • 48
-1 votes
1 answer
48 views

Mac OS X - Brew installed Leiningen permission error / wrong directory

I've never had issue installing Leiningen on multiple machines. But on a new Mac (MacOS 14.3), I can't get lein repl to work: java.io.IOException: Permission denied. Please check your access rights ...
Hugolin Bergier's user avatar
0 votes
1 answer
30 views

Consume SpiceDB LookupResources gRPC stream from Clojure using Java gRPC library

The SpiceDB gRPC endpoint for LookupResources returns a gRPC stream of resource IDs with a cursor. Consuming gRPC streams from Clojure can be gnarly. I know I need to reify StreamObserver and consume ...
Petrus Theron's user avatar
1 vote
1 answer
71 views

Server sent events in pedestal returns empty response

I am currently implementing server sent events (SSE) in an web application using Clojure, Pedestal and Jetty. When I print the message in the backend the channel is open and when I invoke io.pedestal....
Rosen Hristov's user avatar
1 vote
0 answers
106 views

How to make quarkus find my Clojure classes?

I want to use Quarkus with Clojure, i am using Clojurephant plugin that worked fine so far, for example with Vert.x or Springboot. I didn't had any problems but with Quarkus it doesn't work, maybe ...
Takis's user avatar
  • 8,592
0 votes
1 answer
69 views

Looking for a Clojure/LISP equivalent to Scons [closed]

I have found a Scons, a Python-based build language similar to Make. However, I can not seem to find a Clojure/LISP equivalent to this type of build language tool (despite LISPs being seeming well-...
ggg123's user avatar
  • 123
0 votes
2 answers
79 views

lazily calling functions for infinite sequence clojure

I am very new to clojure and want to make obvious programs. (def fib (conj fib (apply + (take-last 2 fib)))) Doesn't work because of no lazy evaluation, nor indication of the start being [0 1] (def ...
jinTgreater's user avatar
0 votes
0 answers
54 views

Issue with Kafka in Clojure Repl for Arm64 M1

I am having issue with Kafka in my repl: Execution error (NullPointerException) at kafka_component.consumer.KafkaConsumer/stop (consumer.clj:21). Cannot invoke "Object.getClass()" because &...
Tanay Murdia's user avatar
1 vote
1 answer
65 views

Unable write parser where the AST can be turned into Clojure code

Given the following example "~a{b=1}&(a{b=1}|a{b=1})|a{b=1}|a{b=1}" I have written the following parser using Instaparse ((insta/parser " S = (group | exp)+ group = '~'? <'('&...
user3139545's user avatar
  • 7,164
2 votes
2 answers
86 views

Naming convention for simbol of clojure.core/atom, like !foo in Clojure

I found a naming !video on Reagent docs. (let [!video (clojure.core/atom nil)] ...) https://github.com/reagent-project/reagent/blob/master/doc/FAQ/UsingRefs.md I liked this rule of prefixing ! to ...
hata's user avatar
  • 167
0 votes
1 answer
174 views

How to nest a sequence of layered steps?

Not really sure what to call this, what I mean is I have a list of steps e.g. [{:id 1 :layer :foo} {:id 2 :layer :foo/bar} {:id 3 :layer :foo} {:id 4 :layer :bar/baz} {:id 5 :layer :foo/bar} {:id ...
Lēctia Landau's user avatar
0 votes
1 answer
61 views

How to type hint a float?

I want to ensure I'm using unboxed and unreflected arithmetic on arrays of floats, but I can't get it to compile. How can I type hint a float in a function like this? (defn ff2a ^"[F" ; ...
Jeff's user avatar
  • 33
0 votes
1 answer
67 views

Unable to resolve symbol: >Chr01 in this context

I have a FASTA file: > cat test.fasta >Chr01 TTGTTGGAGGCGGAAGATTCGTCTTCAACAGTGATATAATTGATATTCGACCTTCTTATGGAAATGCATACTAGTGACAC ...
user3523406's user avatar
0 votes
1 answer
65 views

How to query for all the attributes in xtdb

the following code works, and it retrieves a set of all post ids and their titles - (xt/q db '{:find [post title] :where [[post :post? true] [post ...
Viktor Karsakov's user avatar
0 votes
0 answers
55 views

Clojure Midje and passing functions to functions

I have a function take-selector that accepts a function as an argument. I have a function make-selector that "somehow" generates a function and passes it to take-selector. The code could ...
habrewning's user avatar
1 vote
1 answer
59 views

Clojure2d: drawing on the canvas silently fails if it has been resized

The following code successfully displays a blank canvas with a small red square: (ns test-rect (:require [clojure2d.core :as c2d]) (:require '[clojure2d.extra.utils :refer [show-image]])) (c2d/...
Francois's user avatar
  • 2,047
0 votes
2 answers
125 views

Loading environment variables temporarily on nrepl start up

I have a clojure project using leiningen. I want to load environment variables from a file on nrepl start. I only want this to run on repl start because these environment variables are configured for ...
Ashwin's user avatar
  • 13.1k
0 votes
1 answer
58 views

Why evaluated list returns only number and error in other case? [duplicate]

In Clojure REPL: ('+ 1 2) ; 2 ('+ 1 2 3) ; (err) clojure.lang.ArityException: Wrong number of args (3) passed to: clojure.lang.Symbol Why it happens and how it works? I tried to inspect the code, but ...
rusfrompiter's user avatar
0 votes
1 answer
77 views

What difference between syntax-quote in Clojure and syntax-quote in Clojurescript?

In Clojure REPL: (macroexpand-1 `(sum 2 1)) ; (user/sum 2 1) In Clojurescript REPL: (macroexpand-1 `(sum 2 1)) ; AssertionError: Assert failed: Argument to macroexpand-1 must be quoted Why it ...
rusfrompiter's user avatar
1 vote
0 answers
101 views

Discrepancy in Measuring Execution Time of Concurrent Tasks [duplicate]

The goal is to invoke a function concurrently (e.g., 10 times) and measure the total execution time. However, I'm observing a significant discrepancy between the actual time taken and the time ...
mark_iv's user avatar
  • 56
0 votes
3 answers
103 views

How to transform seq into vector without so much verbosity?

I am trying to implement reorder functionality for a vector of maps. For now, I want to understand how to move un-nested items inside the vector, before I tackle nested vectors, etc. Trying to learn ...
Boristofu Povolotsky's user avatar
1 vote
1 answer
72 views

Webdriver stopped opening Firefox

So, I'm using etaoin to do some webdriver stuff in Clojure. It was working fine for a while. However, my program is crashing on line 7 of this: (ns socialauto.core) (require '[etaoin.api :as e]) (...
Caleb Beers's user avatar
3 votes
2 answers
127 views

Slow parsing CSV file into a map of vectors

I am trying to read in a CSV file and parse it into a map of vectors. So, the keys of the map are the column names from the CSV and the values of the map are vectors containing the columns of values ...
Dan's user avatar
  • 11.8k
2 votes
1 answer
73 views

Lazy evaluation of default parameter in clojure

I have created a function with an optional argument a with a default value corresponding to the result of a function call : (defn mycall[] (print "*** called") 100) (defn hello [& {:...
dedupe's user avatar
  • 29
1 vote
1 answer
81 views

Difference in implementation between clojure.core conj and clojure.core.into

What is the difference in terms of efficiency and under-the-hood details between (apply conj [0][1]) and (into [0][1])? Using the time function it seems that apply conj is faster, but is there a price?...
Shmuel Greenberger's user avatar
1 vote
0 answers
66 views

New warning in clojure on code I've been running for years invokeWithEnv NIYWARNING

I have a clojure program that interacts with Apple Mail via Applescript and Postgresql via the Korma clojure library. Now, seemingly at random, I get a repeat of ca. 100 printed statements "...
John Daschbach's user avatar
3 votes
1 answer
91 views

macro form of clojure.core apply function

in clojure.core there is the apply function, written in a multiple arity style (presumably for efficiency). However I ask whether an implementation like thus: (defmacro apply [f coll] (conj (seq coll) ...
Shmuel Greenberger's user avatar
0 votes
0 answers
233 views

aws Unable to execute HTTP request: Broken pipe (Write failed) when try to upload from test containder to localstack container s3

I tried to use docker container (localstack) to simulate the S3 and upload a file to it. Below are my code: (ns com.my.service.resources.s3 (:require [clojure.tools.logging :refer [error info infof]]...
Laodao's user avatar
  • 1,609
3 votes
6 answers
169 views

Using a mask vector to filter another vector

I have two vectors: (def x [true false true]) (def y [1 2 3]) I'd like to filter y based on x. My initial attempt is like so: (remove nil? (map #(when %1 %2) x y)) which returns (1, 3) as required....
Dan's user avatar
  • 11.8k
0 votes
1 answer
70 views

Clojure use aws jdk's AmazonS3ClientBuilder, but got ClassNotFoundException

I have following clojure code (ns com.my.service.resources.s3 (:require [clojure.tools.logging :refer [error info infof]] [clojure.java.io :as io]) (:import [java.io File ...
Laodao's user avatar
  • 1,609
4 votes
2 answers
131 views

Apply a function to each element of an unspecified number of vectors

Say I have two vectors: (def x [1 2 3]) (def y [4 5 6]) and I want to apply a function (e.g., +) to each element in these vectors sequentially, like so: (defn mapply [x y] (map + x y)) This ...
Dan's user avatar
  • 11.8k
3 votes
0 answers
43 views

datalevin function expression re-binds variable

I am using Datalevin 0.8.16 as a database for my application. I have inserted some data: (datalevin.core/transact! conn [{:hello "some value" :data {:k "other value"}}]) ...
erdos's user avatar
  • 3,327
1 vote
1 answer
100 views

Specifying an application function with clojure.spec

Consider the following apply-like function: (defn apply [f v] (f v)) I would like to specify this function in such a way that its return value satisfies the same specification as the return value ...
MPaga's user avatar
  • 329
0 votes
2 answers
91 views

How do I check if a value in Clojure hash-map exists and equals nil? [duplicate]

When programming in Clojure, I get the same fair answer for both questions: (nil? (:potato {})) => true (nil? (:potato {:potato nil})) => true This sometimes leads to confusion. Is there a ...
Terbiy's user avatar
  • 640
0 votes
0 answers
35 views

What is the impact of creating different streams in riemann?

I am using riemann and I'm trying to understand the difference/imact of (instrumentation {:enabled? true}) (streams (where (service #"^a\.*") prn) ; stream a (streams (where (service #"^...
Vipin Menon's user avatar
  • 3,082
2 votes
1 answer
57 views

How to avoid using `reinject` in riemann clojure?

I have riemann clojure rule as follows (streams (where (service "a") #(info "a-" %) (moving-event-window 2 (smap folds/sum (with :service "a-...
Vipin Menon's user avatar
  • 3,082
1 vote
1 answer
55 views

Adding static files to compojure

I need to add leaningen project my-compojure/src/dist/output.css from tailwind to my compojure project. Where should I put it? After starting the server, I am naively calling localhost:3000/dist/...
David's user avatar
  • 2,971
1 vote
0 answers
72 views

Infinite loop with `counto` relation in core.logic

I am interested in expressing the number of occurrences of an element in a list as a relational goal in Clojure's core.logic library. (Note that this question is not a duplicate of clojure core.logic ...
oper0's user avatar
  • 11
1 vote
0 answers
53 views

Compojure + htmx get yields 403 forbidden

I have build a small hello world app with composure and htmx: (defroutes app-routes (GET "/" [] " <html> <script src=\"https://unpkg.com/[email protected]\"><...
David's user avatar
  • 2,971
1 vote
1 answer
65 views

Function Namespace Conflicts in Clojure Project with Incanter

I'm currently working through "Clojure Data Analysis Cookbook" by Eric Rochester and have encountered an issue with namespace conflicts involving the abs function. I set up my project using ...
user3523406's user avatar
2 votes
1 answer
83 views

How do I apply a PostgreSQL function to a query using Clojure?

(ns training-clj.querys (:require [honey.sql :as honey] [next.jdbc.sql :as jdbc])) (defn get-by-username [db username] (let [query (honey/format {:select [:*] ...
newbie's user avatar
  • 21
2 votes
1 answer
93 views

Clojure/ClojureScript: How to plug in custom print implementation for EDN tag literals?

I have a record, an instance of and I print it to EDN string: (ns my) (defrecord Ref [type id]) (def rich (->Ref :Person 42) (pr-str rich) I would like to get "#my.Ref [:Person 42]. But I get ...
Witek's user avatar
  • 6,300

1
2 3 4 5
354