17,775 questions
0
votes
0
answers
50
views
Clojure, Missionary. Can't sample continous flows more than once
I'm following this tutorial. In the chapter on continuous flows, the author whats to demonstrate that they can be sampled at any time and they are always ready. He presents this code:
(def discrete-...
Advice
0
votes
3
replies
66
views
Clojure inline print for debugging
In clojure, the println function returns a nil:
\>(println "a"
a
nil
This makes it awkward to use print to access an intermediate value when print debugging:
Say I have:
(* (+ 5 10) (- ...
Best practices
3
votes
3
replies
113
views
Event should update data structures
Consider this function:
(defn check-collision
[game]
(let [ball (:ball game)]
(let [result (collision/ball-collision? ball (:paddle game))]
(when (:collision? result)
(resolve-...
1
vote
1
answer
94
views
Cannot invoke "java.lang.Character.charValue()" because "x" is null
This is the code fragment of the error:
(defn end-render
[fb]
(let [width (get-in fb [:dimen :width])
height (get-in fb [:dimen :height])
msfbo (:msfbo fb)
fbo (:fbo fb)]
...
3
votes
1
answer
152
views
How to write an accumulative recursive function in J without looping
At the risk of asking a question with an obvious solution: if I have a function in J that takes two arguments and returns two arguments and I want to accumulate the answer's second argument and to use ...
1
vote
0
answers
96
views
Clojure problems in resolving .local server address inside private network
First of all thanks in advance for any help, this is the first time I'm setting up a system like this, so a few points are not clear and might be written in bad form (and that's why I'm here).
...
1
vote
1
answer
99
views
How to type hint a float array?
This code
(GL33/glUniform2fv ^int (location shader "offsets") ^float [] offsets)
produces this error:
No matching method glUniform2fv found taking 3 args for class org.lwjgl.opengl.GL33
I'...
3
votes
0
answers
140
views
Fast lazy sort & deduplication over multiple sorted lazy sequences in Clojure
I implemented a few lazy sort & merge functions that are used heavily in my ReBAC authorization library, EACL, to lazily "merge" & deduplicate ~1M datoms emitted from Datomic's d/...
1
vote
1
answer
103
views
Intellij & Clojure LSP - Getting Started
I'm just trying the Clojure LSP plugin in Intellij IDEA Community without knowing anything about Clojure or the plugin.
My goal is to start learning Clojure.
I installed the plugin and clojure-lsp via ...
1
vote
1
answer
49
views
Parse nested metadata
One thing I like about metadata is that I can organise functions across namespaces. E.g.:
(defn ^{:category 1} a-function []
(do-stuff))
(->> (ns-interns 'this.namespace)
vals
(map ...
0
votes
1
answer
66
views
How to include a file with shadow-cljs/inline, but preprocess it first?
Shadow-cljs has a resource loader that can include literal files into the Clojurescript code
(ns app.my
(:require
[shadow.resource :as rc]))
(rc/inline "file.txt")
I need a macro that ...
0
votes
1
answer
93
views
Complains about a non-existent PersistentArrayMap
In this function I get an exception:
(defn ball-collision?
[ball brick]
(let [^org.joml.Vector3f ball-pos (:position ball)
^org.joml.Vector3f brick-pos (:position brick)
^org.joml....
1
vote
2
answers
119
views
Avoid garbage when using atoms
Consider this code snippet which calculates the delta time since the last frame:
(defn game-loop
[window game]
(let [last-frame (atom (GLFW/glfwGetTime))]
(while (not (GLFW/...
1
vote
1
answer
100
views
Appending to a vector in a map, but referencing the map only once
Consider this map:
(def my-map {:a-vec []})
Now I want to append some value to a-vec:
(assoc my-map :a-vec (conj (:a-vec my-map) 17))
What I don't like about this is that I name both the map and the ...
1
vote
0
answers
144
views
My clojure project.clj can't be loaded in intellij with Cursive, it interfere with proxy settings
When enabling Cursive in Intellij 2024.03 it throws:
Error reading C:\myprocect-path\project.clj
class com.intellij.credentialStore.OneTimeString cannot be cast to class java.lang.String (com.intellij....