I'm working on some Clojure code that has some circular dependencies between different namespaces and I'm trying to work out the best way of resolving them.
Basic issue is that I get a "No such var: namepace/functionname" error in one of the files
I tried to "declare" the function but then it complains with: "Can't refer to a qualified...
Hi,
I'm trying to write a simple mail server using Python.
I found smtpd that can be used as a simple smtp server, but I don't think it supports any form of authentication.
For pop or imap, I haven't found anything at all yet.
I do know Twisted has some support for both smtp and pop or imap, but I can't find any examples or tutorials...
How can I evaluate a list of (impure) functions in Clojure? For instance:
[#(println "1") #(println "2") #(println "3")]
The expected output is:
1
2
3
Is there a way to achieve this without using macros? Something like (map evaluate fns-seq), maybe?
(I need this for drawing some graphics using the Clojure.processing API.)
...
When I try to run this code in eclipse:
(ns cl1
(def s 1)
(print s)
)
I get
java.lang.Exception: No such var: clojure.core/def (clojure.clj:1)
I'm a complete clojure newbie, but I think that the above code should create the symbol s, and then print what s is equivalent to to the screen (1).
...
I've been looking around, and I can't seem to find any definitive answer or headway that seems "up to date". I've seen some interesting projects like Duby, and am looking into it a bit. I've seen Jruby unsuccessfully used to compile ruby into .dex. I've also been looking, independently, into Clojure and have realized that they might a...
I wrote this function that does this (easier to show than explain):
(split 2 (list 1 2 3 4 5 6))
=> ((1 2) (2 3) (3 4) (4 5) (5 6))
(defn split [n xs]
(if (> (count xs) (dec n))
(cons (take n xs) (split n (rest xs)))
'()))
I understand that in Clojure the list is not the only first class data structure. Would it mak...
This is a double question for you amazingly kind Stacked Overflow Wizards out there.
How do I set emacs/slime/swank to use UTF-8 when talking with Clojure, or use UTF-8 at the command-line REPL? At the moment I cannot send any non-roman characters to swank-clojure, and using the command-line REPL garbles things.
It's really easy to do ...
Are all immutable data structures in Scala persistent? If not, which of them are and which not? What are the behavioural characteristics of those which are persistent? Also, how do they compare to the persistent data structures in Clojure?
...
It seems that to install Clojure in every new IDE, I have to completely re-install it and create a copy of it. And running the REPL seems like it's running a Java program.
I'm coming from a Ruby background, where Ruby programs are run by ruby program.rb, and the ruby being a program executed from one place, onto the file (I am aware th...
I am developing a complex data structure in Clojure with multiple sub-structures.
I know that I will want to extend this structure over time, and may at times want to change the internal structure without breaking different users of the data structure (for example I may want to change a vector into a hashmap, add some kind of indexing ...
I seem to be doing something wrong. I've built clojure from git, and am invoking it thus:
java -cp clojure.jar clojure.main
I get the repl, and then I type:
(import 'java.lang.string)
and I get:
java.lang.ClassNotFoundException: java.lang.string (NO_SOURCE_FILE:1)
I'm trying this with lang.string since I assume it has to exist o...
I followed this guide:
http://wiki.unto.net/setting-up-clojure-and-slime
Which walked me through the steps of building Clojure and Clojure-contrib from source along with SLIME and swank emacs scripts. I am a total noob when it comes to emacs.
I am getting this error:
File error: Cannot open load file, swank-clojure-autoload
This...
I want to write a function that would return the boolean true if the given collection is not empty and false otherwise.
I could either do
defn ..
(boolean (seq coll))
or
defn ..
(not (empty? coll))
As I am new to clojure I was initially inclined to go with #2 (more readable), but the clojure api reference for empty? explicitly sa...
(defn divisible [x y] (zero? (rem x y)))
((or (fn [x] (divisible x 3)) (fn [x] (divisible x 5))) 3)
((or (fn [x] (divisible x 3)) (fn [x] (divisible x 5))) 5)
the first expression evals to true but not the second one why?
can some on explain whats going on here?
...
As far as I can tell 90% of information that can be found through a google search on compojure/ring is outdated for 0.4.0.
Can anyone point me toward some good current documentation?
Thanks!
...
I'm feeling slightly silly here, but I can't get Clojure Hello World to compile.
Directory structure:
hello-world/
clojure-1.1.0.jar
build/
classes/
src/
test/
hello.clj
hello.clj:
(ns test.hello
(:gen-class))
(defn -main [& args]
(println "Hello" (nth args 0)))
Interaction:
$ cd hello-world
[hello-world]...
I'm working on Clojure app where a client needs to send some commands to a server. These will happen in quite large volumes, so I'd like it to be reasonably efficient, both in terms of processing and over-the-wire serialised size.
What would be the best way of doing this in Clojure?
Currently I'm thinking of:
Creating a simple standa...
I'm not sure whether this belongs on StackOverflow or in the Clojure Google group. But the group seems to be busy discussing numeric improvements for Clojure 1.2, so I'll try here:
http://shootout.alioth.debian.org/ has a number of performance benchmarks for various languages.
I noticed that Clojure was missing, so I made a Clojure ve...
I'm trying to embed a swank-clojure repl into my application for the purpose of connecting while the app is running to muck around with things. However, I'm having trouble figuring out how to access the enclosing environment after starting the repl.
Embedding the swank-clojure REPL is easy enough:
(ns mytest
(:use [swank.swank :exclu...
Any pointers to scheme/racket or clojure bayesian classification libraries? I need one for a toy/learning project that I'm going to do.
...