Skip to main content
7 votes
3 answers
4k views

I have some algorithm which for one reason or another spits out NaNs, I would both like to just filter out these bad results for the time being, and some point later go and find out the problem. ...
15 votes
3 answers
707 views

I want to visualize a graph that represents some geographical map. As such, the edges of my graph are associated with the compass rose (north, south, east, west). The graph itself is directed and can ...
0 votes
0 answers
54 views

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-...
2 votes
2 answers
357 views

I recently purchased Inferring Phylogenies by Joseph Felsenstein, which is a great book about mathematical and computational methods for inferring phylogenetic trees, and have been playing around with ...
0 votes
1 answer
317 views

I'm doing CPU profiling on my Mandelbrot Set explorer. For some reason, clojure.lang.PersistentHashMap$BitmapIndexedNode.find is using a fairly large percentage of the total CPU time. When I take a ...
0 votes
1 answer
402 views

I'm trying to replace all single quotation marks with double quotation marks in Clojure. i.e. if the string id " 'name' " I want it to become " "name" ". How can I do ...
Advice
0 votes
3 replies
66 views

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) (- ...
8 votes
1 answer
760 views

There is a standard function clojure.core/bean converting POJO to map: class MyPojo{ public String getFirst(){ return "abc"; } public int getSecond(){ return 15; } } IFn bean = Clojure....
Best practices
3 votes
3 replies
113 views

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
49 views

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 ...
3 votes
1 answer
377 views

I am trying to represent time information that has precision at the scale of year or year-month. Eg. 'patient has a history of fracture of the right wrist in 1998'; 'history of headaches since October ...
1 vote
1 answer
94 views

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)] ...
1 vote
1 answer
99 views

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

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/...
3 votes
1 answer
154 views

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 ...

15 30 50 per page
1
2 3 4 5
1185