As part of a python simulation I have I take a 2d array and take the gradient of this array. This is done in scipy/numpy by convolving the 2d array with a filter with the appropriate weights.
So my question is if I want to do this in clojure reasonably fast does it make sense to do this in pure clojure, or is it better to use a Java ...
I need to read bytes from this Blob. I'm trying the following but I'm getting this exception:
oracle.sql.BLOB cannot be cast to [B
(defn select-test2[]
(clojure.contrib.sql/with-connection db
(with-query-results res ["SELECT my_blob from some_table"] (doall res))))
(defn obj [byte-buffer]
(if-not (nil? byte-buffer)
(with-o...
How to insert a blob in database using the clojure.contrib.sql?
I've tried the following reading from a file but I'm getting this exception:
SQLException:
Message: Invalid column type
SQLState: 99999
Error Code: 17004
java.lang.Exception: transaction rolled back: Invalid column type (repl-1:125)
(clojure.contrib.sql/with-connection...
1: user=> (def some-account {:number :any-number :balance :any-balance :bank :any-bank})
2: #'user/some-account
3: user=> (contains? some-account :bank)
4: true
5: user=> (assoc some-account :owner :any-owner)
6: {:owner :any-owner, :number :any-number, :balance :any-balance, :bank :any-bank}
7: user=> (contains? some-account :owne...
if i played with a lot of code in a repl console, how can i clear it ? i would like a fresh one without restarting it. can that be done ?
...
Here I check the environment variable CLASSPATH
daniel@daniel-laptop:~/ps/clojure/projects/ring-tutorial$ echo $CLASSPATH
/home/daniel/ps/clojure/projects/ring-tutorial/src
Here I check what java thinks it is.
daniel@daniel-laptop:~/ps/clojure/projects/ring-tutorial$ lein repl
Clojure 1.1.0
user=> (System/getProperty "java.class.path")
...
In Python I would do the following:
>>> q = urllib.urlencode({"q": "clojure url"})
>>> q
'q=clojure+url'
>>> url = "http://stackoverflow.com/search?" + q
>>> url
'http://stackoverflow.com/search?q=clojure+url'
How do I do all the encoding that's done for me above in Clojure? In other words, how do I do something akin to the following...
I decided to take a look at Clojure and thought the best and easiest method for me would be to use Netbeans with the Enclojure plugin as I didn't want to have to learn Emacs at the same time. I installed Netbeans 6.9.1 together with the latest JDK using the bundled install (on Windows 7). All went smoothly. I then followed the instruct...
I would like to cast a clojure Java object (assigned with let*) to another Java class type. Is this possible and if so then how can I do this?
Update:
Since I posted this question I have realised that I do not need to cast in Clojure as it has no concept of an interface, and is more like Ruby duck typing. I only need to cast if I need t...
In some implementations of Common LISP we can say that for the following expression
(eq 'a 'a)
Is true because 'a and 'a are the "same atom".
This may be implementation dependent, but it seems the phrase (used in a popular LISP teaching book) assumes that atoms of the same value are stored in the same location in memory.
In Java, ...
The following page talks about how atoms work in Clojure. It doesn't say a whole lot about the differences between atoms in Clojure and other lisp dialects.
What is the primary difference between an atom in Common Lisp and an atom in Clojure? (What is missing from the definition of atom in Clojure that exists in CL?)
...
What is the difference between the defn and defmacro ? What is the difference between a function and a macro ?
...
I'm not very familiar with Clojure/Lisp macros. I would like to write apply-recur macro which would have same meaning as (apply recur ...)
I guess there is no real need for such macro but I think it's a good exercise. So I'm asking for your solution.
...
I have implemented an A* search algorithm for finding a shortest path between two states.
Algorithm uses a hash-map for storing best known distances for visited states. And one hash-map for storing child-parent relationships needed for reconstruction of the shortest path.
Here is the code. Implementation of the algorithm is generic (st...
Hi guys, I'm using clojure-http to make the following POST:
(clojure-http.resourcefully/post "https://android.apis.google.com/c2dm/send"
{"Authorization" (str "GoogleLogin auth=" auth-token)}
{"registration_id" registration-id
"data.msg" "blah"
"collapse_key" "blah"})
And getting this exception:
java.security.cert.Certifica...
Hi,
I ran lein uberjar on my project and it created the corresponding jar files. When I run the jar a ClassNotFoundException: explodingdots.core is thrown. I specified explodingdot.core as my main class. I extracted the jar file and there was indeed no core.class in the corresponding directory. What did I forget?
I have the following c...
how do i create a project (a clojure project) in netbeans on windows given that i have the original project on git hub (http://github.com/babo/ai-contest-planet-wars-clj). i want this project in netbeans so i can make use of the enclojure plugin
thx
...
Hello, Clojure truly piqued my interest, and I started going through a tutorial on it:
http://java.ociweb.com/mark/clojure/article.html
Consider these two lines mentioned under "Set":
(def stooges (hash-set "Moe" "Larry" "Curly")) ; not sorted
(def more-stooges (conj stooges "Shemp")) ; -> #{"Moe" "Larry" "Curly" "Shemp"}
My first th...
Hello fine StackOverFlow'ers,
I'm looking for a test coverage tool for my clojure project. Currently it's a pure clojure project.
...