Extensions and enhancements to the Clojure libraries.
Questions tagged [clojure-contrib]
108 questions
6
votes
2 answers
Find where clojure-contrib libs have moved to
Given how with future version of clojure are discouraging use of clojure-contrib as a single item - how do you find where things have moved to.
For example - this utility:…

Michael Neale
- 19,248
- 19
- 77
- 109
6
votes
1 answer
Tips for Html parsing and web driving with clojure?
I want to automate filling in data on a website using clojure.
For this I want to query elements of webpages and create http requests. I have been looking at using HttpUnit and contrib.clojure.zip-filter.xml. So far neither approach feels…

Peter Tillemans
- 34,983
- 11
- 83
- 114
6
votes
3 answers
Picking "Random" elements from a vector
I am looking to pick out random (that is pseudorandom) elements from a vector. The function would have an input, call it r, that would select the number of elements to be selected. Also, the vector, call it v, would also have to be an input. This is…

sunspots
- 1,047
- 13
- 29
6
votes
5 answers
Compojure HTML Formatting
I'm relatively new to Clojure and a complete HTML/Compojure virgin. I'm trying to use Compojure to create static pages of HTML using a function similar to this:
(defn fake-write-html
[dir args]
(let [file (str dir *file-separator* *index-file*)
…

clartaq
- 5,320
- 3
- 39
- 49
5
votes
1 answer
How to find import-static in clojure 1.3
I am reading "Programming Clojure", and this book is based on clojure 1.1.
I want to use the latest stable version, 1.3, but it does not have old clojure-contrib.
My problem is that I cannot find import-static in clojure 1.3.
I could copy the macro…
user943820
5
votes
3 answers
How to Execute Clojure File?
How can I run a clojure file/script, which uses clojure-contrib, from the command line? My (winodws) machine has clojure-1.2.1.jar and clojure-contrib-1.2.0.jar on the classpath. Note: I can start the REPL with: java clojure.mainand I can execute…

tmore
- 693
- 1
- 6
- 6
5
votes
3 answers
How to convert a sequence to a byte[] in Clojure?
I need to write raw bytes to the file. I do it with:
(.write (FileOutputStream "/path") bytes)
...where bytes must be of type byte[]. Please note it cannot be Byte[].
I tried to convert my sequence with both (bytes) and/or (into-array) functions…

qertoip
- 1,870
- 1
- 17
- 29
5
votes
1 answer
How to install clojure-contrib on Windows?
I can't seem to find a way to launch the Clojure REPL with the contrib library included. If I understood the documentation correctly then this command should do it:
C:\clojure-1.1.0>"%ProgramFiles%\Java\jre6\bin\java.exe" -cp…

StackedCrooked
- 34,653
- 44
- 154
- 278
5
votes
1 answer
Where did defadt go in new clojure contrib?
So digging around trying to figure out how to do ADTs in Clojure I run into the old clojure-contrib which is well and good except that it's been replaced. Ok no big deal, just go look through the replaced clojure-contrib's catalog of broken apart…

Jimmy Hoffa
- 5,909
- 30
- 53
4
votes
2 answers
How do I extend clojure.contribs json writer to serialize other classes
I need to create JSON objects from clojure maps that store things like clojure vars. The base implementation throws this kind of error when it sees them:
java.lang.Exception: Don't know how to write JSON of class clojure.lang.Var
Can anybody point…

zippy
- 1,228
- 10
- 19
4
votes
1 answer
How do you get all the functions defined in the namespace in Clojure?
I want to see all the functions defined in the current namespace. Is there a function I can call in the REPL that can answer this question?

dan
- 43,914
- 47
- 153
- 254
4
votes
1 answer
Compojure + clojure.contrib.sql: SELECT query is being cached. Why?
I'm writing a Compojure TODO app and with MySQL as the primary data store. I'm using clojure.contrib.sql to interface with MySQL as follows:
(def db {:classname "com.mysql.jdbc.Driver"
:subprotocol "mysql"
:subname…

Dan Loewenherz
- 10,879
- 7
- 50
- 81
4
votes
1 answer
Unexpected base 64 decode result in Clojure
I have required:
[clojure.data.codec.base64 :as b64]
I have defined a function:
(defn toHexString [bytes]
"Convert bytes to a String"
(apply str (map #(format "%x" %) bytes)))
I run this code to get a result in Clojure:
(toHexString…

adrianmcli
- 1,956
- 3
- 21
- 49
4
votes
2 answers
How to create a multipart request in clojure using clj-http api
I want to create a multipart HTTP request using clj-http. Multipart request is below:
--Boundary
Content-Type: text/xml; charset=UTF-8
Content-Id id1
xml1
--Boundary
Content-Type: text/xml; charset=UTF-8
Content-Id id2
xml2
--Boundary--
I am…

Jitendra
- 51
- 3
4
votes
1 answer
How does the ClojureScript compiler transform cljs to Javascript
I am having a little difficulty seeing how this is done. How is it able to convert it to JS without writing any JS (everything is in Clojure or CS).
Can someone give a simple example of how the compiler would convert something simple to javascript.…

Jonovono
- 1,979
- 7
- 30
- 53