clojure

Creating an executable jar file from a clojure project?

I have a clojure project that uses the slick 2d game engine that I am trying to run as an executable jar file. I created the project in both Netbeans and Eclipse and I have had no luck exporting them into an executable format. It keeps giving the error could not find the main class, followed by giving my main class. I have tried editing ...

Clojure equivalent to Python's lxml library?

I'm looking for the Clojure/Java equivalent to Python's lxml library. I've used it a ton in the past for parsing all sorts of html (as a replacement for BeautifulSoup) and it's great to be able to use the same elementtree api for xml as well -- really a trusted friend! Can anyone recommend a similar Java/Clojure library? About lxml ...

Implementing a Command Line Interpreter with a functional language

Hi, I'm toying with the idea of writing a command line interpreter and I suspect that a functional language such as Clojure is well suited to this task. I am however 5 years out of a CS degree and my only experience with functional languages was a harrowing experience with Haskell in a third year languages course. So, is a language suc...

Why Clojure instead of Java for concurrent programming

When Java is providing the capabilities for concurrent programming, what are the major advantages in using Clojure (instead of Java)? ...

How do I mix JVM based languages in a single Netbeans project?

For example, is it possible to have Scala, Java, and Clojure source all compile/build together properly inside the same project? Or, do I have to do them as separate project libraries then used by whatever I pick as the "master" project? If neither of those, how's everyone else doing it? ...

If I'm making a mail system that manages large amounts of email would I be better off using james or Javamail

I'm trying to decide whether to use James(http://james.apache.org/) or Javamail(http://java.sun.com/products/javamail/) to build a email system that takes and processes email. It will send and recieve email along with processing the content, checking for spam etc. What are the advantages/disadvantages of each and which do you recommend I...

Declare Member Variables with gen-class in Clojure

I'm learning how to extend Java classes in Clojure, but I don't see a way declare new member variables; I only see a way for methods. (ns test.aclass (:gen-class :methods [[foo [] String]])) Is there a :members keyword or another way of declaring member variables? ...

Lazy infinite sequences in Clojure and Python

Here are the best implementations I could find for lazy infinite sequences of Fibonacci numbers in both Clojure and Python: Clojure: (def fib-seq (lazy-cat [0 1] (map + fib-seq (rest fib-seq)))) sample usage: (take 5 fib-seq) Python: def fib(): a = b = 1 while True: yield a a,b = b,a+b sample usage: for i in fib(): i...

Clojure prime numbers lazy sequence

What is the Clojure equivalent (for the exact algorithm) of the following Python code? from itertools import count from math import sqrt def prime_gen(): primes = [] for n in count(2): if all(n%p for p in primes if p <= sqrt(n)): primes.append(n) yield n ...

When I divide numbers in clojure i get a fraction , how do I get the decimal?

When i do (/ 411 125) , i dont get it in terms of decimal, how do I do that? ...

What is a good emeddable language for an existing Java application?

I want to embed a dsl or existing full language within my application. It should be a simple, full Turing complete language but simple and light enough that the code can be interpreted without too much overhead. Also the other "processes" can't effect any other process. I was considering using Clojure and invoking the Clojure interpret...

Clojure binding not working

I'm working through the Clojure examples in Stuart Halloway's "Programmming Clojure" and I've hit a snag when using binding: (def foo 10) ; => '#user/foo foo ; => 10 (binding [foo 42] foo) ; => 10 (binding [user/foo 42] foo) ; => 10 (binding [user/foo 42] (var-get #'user/foo)) ; => 10 Why won't it give me 42? ...

Idiomatic Mode function in Clojure

Hi All, I'm learning Clojure and would like some advice on idiomatic usage. As part of a small statistics package, I have a function to calculate the mode of a set of data. (Background: The mode is the most common value in a set of data. There are almost a dozen published algorithms to calculate it. The one used here is from "Fundamenta...

What is Sun's attitude towards Clojure?

What is their official position towards clojure? ...

Tutorial for ClojureBox

I'm trying to learn clojure. ClojureBox appears to be similar to LispBox - http: //gigamonkeys.com/lispbox/ which I've used previously. I'm looking for a good clojure specific tutorial on using emacs as it's configured with clojurebox. Here are some specific questions I have: How do I create a new clojure file in emacs and Load an ...

Can you give me some real-life examples of the -> macro?

It seems to be a powerful macro, yet I'm failing to apply it to anything but silly examples. Can you show me some real use of it? Thanks! ...

Clojure Development: IDE or REPL?

I've been using Clojure for a little while and want to create some projects that are bigger and more complicated than toys. I've been using Java for the past few years and have become accustomed to what IDEs do for me -- compile lots of classes, package them up in jars, create batch files for users to start them with. When I look at exa...

How do you make a binary search tree in Clojure?

In Scheme, I can use define-struct to make a binary search tree, but how do you do it in Clojure? ...

Clojure function argument syntax

I'm trying to understand the syntax for calling use to load a library: (use 'clojure.contrib.duck-streams) Makes sense to me as it applies the quote reader macro to clojure.contrib.duck-streams so that the reader doesn't attempt to evaluate that string. Now, if I want to use the :only tag to only load reader, why is this correct: (u...

Running Clojure Box in Windows 7

Has anyone had a problem running Clojure Box in Windows 7? I am trying to run a fresh install of Clojure Box on a fresh install of Windows 7 Professional (64 bit). Java version on system is 1.6.0_16. emacs starts up but produces the following error messages: Warning (initialization): An error occurred while loading `~/.emacs': ...