1,897 questions
176
votes
10
answers
53k
views
Calling clojure from java
Most of the top google hits for "calling clojure from java" are outdated and recommend using clojure.lang.RT to compile the source code. Could you help with a clear explanation of how to call Clojure ...
143
votes
12
answers
18k
views
Why exactly is eval evil?
I know that Lisp and Scheme programmers usually say that eval should be avoided unless strictly necessary. I’ve seen the same recommendation for several programming languages, but I’ve not yet seen a ...
123
votes
7
answers
107k
views
How to bundle a native library and a JNI library inside a JAR?
The library in question is Tokyo Cabinet.
I want is to have the native library, JNI library, and all Java API classes in one JAR file to avoid redistribution headaches.
There seems to be an attempt ...
120
votes
3
answers
29k
views
What is the difference between Lisp-1 and Lisp-2?
I have tried to understand the difference between Lisp-1 and Lisp-2 and how this relates to Clojure but I still do not understand properly. Can anyone enlighten me?
66
votes
6
answers
82k
views
How do you change the CLASSPATH within Java?
How do you change the CLASSPATH of a Java process from within the Java process?
Before you ask me "Why would you want to do that?" I'll explain it shortly.
When you have a Clojure REPL running it ...
39
votes
2
answers
2k
views
Recursive function causing a stack overflow
I am trying to write a simple sieve function to calculate prime numbers in clojure. I've seen this question about writing an efficient sieve function, but I am not to that point yet. Right now I am ...
22
votes
3
answers
2k
views
When to use a Var instead of a function?
I am going through the book Web Development with Clojure and it tells me to pass the handler (defined bellow) as a Var object instead of as the function itself, since the function can then change ...
121
votes
11
answers
46k
views
leiningen - how to add dependencies for local jars?
I want to use leiningen to build and develop my clojure project. Is there a way to modify project.clj to tell it to pick some jars from local directories?
I have some proprietary jars that cannot be ...
142
votes
5
answers
117k
views
A regex to match a substring that isn't followed by a certain other substring
I need a regex that will match blahfooblah but not blahfoobarblah
I want it to match only foo and everything around foo, as long as it isn't followed by bar.
I tried using this: foo.*(?<!bar) ...
50
votes
4
answers
9k
views
Is there a Haskell idiom for updating a nested data structure?
Let's say I have the following data model, for keeping track of the stats of baseball players, teams, and coaches:
data BBTeam = BBTeam { teamname :: String,
manager :: Coach,
...
35
votes
4
answers
4k
views
conda, condi, conde, condu
I'm reading the Reasoned Schemer.
I have some intuition about how conde works.
However, I can't find a formal definition of what conde/conda/condu/condi do.
I'm aware of https://www.cs.indiana.edu/~...
123
votes
2
answers
31k
views
Difference between doseq and for in Clojure
What's the difference between doseq and for in Clojure? What are some examples of when you would choose to use one over the other?
89
votes
6
answers
24k
views
Generating permutations lazily
I'm looking for an algorithm to generate permutations of a set in such a way that I could make a lazy list of them in Clojure. i.e. I'd like to iterate over a list of permutations where each ...
48
votes
3
answers
10k
views
How to handle java variable length arguments in clojure?
I'am wrapping a java lib into clojure, but i have problems dealing with variable length arguments. Say,
TestClass.aStaticFunction(Integer... intList){/*....*/}
How could i call this function in ...
2
votes
1
answer
966
views
How do I write a Clojure threading macro?
I am attempting to write a threading macro using failjure/ok->> (https://github.com/adambard/failjure#ok--and-ok-), with the final function in the thread requiring a condition to execute. The ...