17,776 questions
Score of 3
3 answers
148 views
Should "side CAUSES", even just global constants, be avoided when writing functions (in Clojure and ClojureScript but really any functional language)?
When it comes to writing pure functions, I have heard of avoiding "side effects" many times, but recently I heard of avoiding "side causes" as well.
I take "side causes" ...
Score of 0
4 answers
192 views
FileNotFound exception in Java/Clojure interop
My Java code sets up a microphone to hear sounds. After some processing of the sounds, control passes to my Clojure code to listen to what was heard. In attempting to invoke the 'Listening' function ...
Score of 1
1 answer
107 views
Problem with generating Swagger doc using `compojure.api`
I'm using compojure.api.sweet for REST end-points:
(defroutes http-routes
(context "/payrolls" []
:tags ["Payrolls"]
(POST "/" [company-id]
:body [doc ...
Score of 1
1 answer
129 views
How do I implement custom coercion with compojure.api.sweet?
I'm implementing an end-point using compojure.api.sweet:
(defroutes http-routes
(context "/shifts" []
(POST "/" []
:body [doc Shift]
(create-shift doc))))
Shift ...
Score of 0
2 answers
82 views
CIDER: do not run removed test
I wrote a test that fails. Then I run command cider-test-ns-tests and got the expected error.
Next step, I comment or remove that failing-test but when I do again run cider-test-ns-tests I still get ...
Score of 3
0 answers
104 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-...
Score of 1
3 answers
118 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) (- ...
Score of 0
3 answers
141 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-...
Score of 1
1 answer
131 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)]
...
Score of 3
1 answer
206 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 ...
Score of 1
0 answers
149 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).
...
Score of 1
1 answer
122 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'...
Score of 4
0 answers
219 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/...
Score of 1
1 answer
168 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 ...
Score of 1
1 answer
71 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 ...