Extensions and enhancements to the Clojure libraries.
Questions tagged [clojure-contrib]
108 questions
1
vote
2 answers
Cannot get clojure-contrib sql to load - FileNotFoundException
I installed clojure and clojure contrib manually, through homebrew and mac ports all of them gives me this error.
I can get other parts to work.
What gives?
edit
this question seems similar
Can not get clojure-contrib to load -…

khebbie
- 2,490
- 3
- 31
- 53
1
vote
2 answers
Clojure read Oracle Blob
I need to read an geometry as a WKB string in Clojure, for that I try to use clojure/java.jdbc
(require '[clojure.java.jdbc :as j])
(->> (j/query db "select SDO_UTIL.TO_WKBGEOMETRY(geometry) wkb from t where idf = 1")
(map #(-> % :wkb…

Bogdan
- 702
- 3
- 6
- 22
1
vote
2 answers
clojure-api: Single main clj for multiple API handlers
The below is my app project.clj
(defproject clojure-my-app-api "0.1.0-SNAPSHOT"
:description "FIXME: write description"
:url "http://example.com/FIXME"
:license {:name "Eclipse Public License"
:url…

Srini
- 823
- 5
- 10
- 29
1
vote
3 answers
Adding key- value pairs to maps in a list of maps from another list of maps in clojure
I have a list of maps
( {:path "first" :size "1 gb"}
{:path "second" :size "500 mb"}
...)
and another list of maps
( {:path "first" :size "1 gb" :date "1"}
{:path "second" :size "500 mb" :date "1"}
{:path "first" :size "0.9 gb" :date…

user3083633
- 81
- 8
1
vote
3 answers
How to include clj-time and clojure.contrib under clojure 1.2?
I tried to migrate a project from clojure 1.1 to 1.2 because of the new protocols introduced in 1.2. But when I try to :use clojure-contrib.duck-streams I get a warning about 'spit' which already exists in clojure.core. The same problem with…

Tiasmadu
- 91
- 2
1
vote
1 answer
Where did clojure.contrib.string/partition go?
Ok, I am mildly confused about the whole clojure.contrib reorganisation.
I identified clojure-contrib.string/partition as the function that I need.
However the last commit is 4 years ago and apparently everything from clojure.contrib moved to…

sebastiangeiger
- 3,386
- 7
- 29
- 37
1
vote
1 answer
Random Walk in Clojure
I have written the following piece of code for a random walk, which draws random values from {-1,1}.
(defn notahappyfoo [n]
(reverse (butlast (butlast (reverse (interleave (take n (iterate rand (- 0 1)))(take n (iterate rand 1))))))))
However, the…

sunspots
- 1,047
- 13
- 29
1
vote
1 answer
Finding and using clojure.contrib.string
I have CounterClockwise for Eclipse and believe clojure.contrib should be installed. However, I can't seem to use it or any of the subfiles such as clojure.contrib.string. If I type as I get the following errors
If I type (require…

animalcroc
- 283
- 4
- 13
1
vote
2 answers
Converting inputs of arbitrary depth to vectors
Take a function which inputs a set, set of sets, collection, nested vector with collections buried within, etc. So, the inputs sometimes are not of the same type. How would one go about converting such input into a nested vector structure? In the…

sunspots
- 1,047
- 13
- 29
1
vote
1 answer
Regex for dates in Clojure
The format of dates I am looking to capture fall into permutations of the pattern "word/DD/YYYY" where word corresponds to months, i.e.
(def months ["january" "January" "february" "February" "march" "March" "April" "april" "may" "May" "june" "June"…

sunspots
- 1,047
- 13
- 29
1
vote
2 answers
Reshaping nested vectors
Given a nested vector A, which is the 3 x 4 matrix
[[1 4 7 10] [2 5 8 11] [3 6 9 12]]
Transform A such that the nested vector (matrix) is now 2 x 6.
The output would look like
[[1 3 5 7 9 11] [2 4 6 8 10 12]]
As of now I am stuck on the beginning…

sunspots
- 1,047
- 13
- 29
1
vote
2 answers
Generating pseudorandom numbers drawn from a uniform distribution
I'm looking to build a function in Clojure that outputs m x n matrix of pseudorandom numbers drawn from the open interval (0,1). The specified inputs would be the row dimension m and column dimension n. I have familiarity with constructed matrices,…

sunspots
- 1,047
- 13
- 29
1
vote
1 answer
Iterating in Clojure over vectors
Given a vector, or possibly nested vector, how do you iterate a function in Clojure over the vector (nested vector) n times? Moreover, how can you output each level of iteration into a vector? Whereby the output vector starts with the initial…

sunspots
- 1,047
- 13
- 29
1
vote
2 answers
repeatedly apply a function until test no longer yields true
I wrote this code to nest a function n times and am trying to extend the code to handle a test. Once the test returns nil the loop is stopped. The output be a vector containing elements that tested true. Is it simplest to add a while loop in this…

sunspots
- 1,047
- 13
- 29
1
vote
1 answer
Threading arrays with level specification
Given a function, vectors or arrays, and level specification as input. What is the simplest way in Clojure to output pairwise threading of the function? Given two vectors I first tried
(vec (interleave [:a :b] [1 2]))
[:a 1 :b 2]
For arrays I used…

sunspots
- 1,047
- 13
- 29