Hey,
Of course I'm not talking about using Clojure just because I can.
I'm curious about where/when to use Clojure and what is the value it brings to a project.
Suppose I'm doing Java web development, where I can use Clojure? any use cases are in your mind?
Thanks.
...
I download the clojure 1.2 and clojure-contrib-1.2.0.jar from the download site.
And I found the info about the math functions.
As is shown in the example, I tried to run the code.
(ns your-namespace
(:require clojure.contrib.generic.math-functions))
(println (abs 10))
But, I got the following error, when I run as follows.
CLOJUR...
I make a clj script for running clojure as follows.
java -cp $CLOJURE_JAR:$CLASSPATH clojure.main $1
The problem is that $1 is the name of the script, so I can't pass the argument with this.
The alternatives can be
java -cp $CLOJURE_JAR:$CLASSPATH clojure.main $1 $2 $3 $4 $5
hoping that the number of arguments is less than four, ...
I've been focusing on Clojure recently as a possible functional language to do systems scripting. Until, it dawned on me that having the JVM underneath means I'm limited to Java's capability.
So, how do I create a symlink? Or a hard link? I mean without (sh "ln" ...).
...
I set up my Emacs for Clojure using the instructions at Clojure's web site. I used the first option in setting up the inferior-lisp-program variable, basically "java clojure.main".
With this setup, C-c C-z works in getting me to the Clojure REPL. However, when I'm editing a file and I type C-c C-l to load the file into the REPL, Emacs ...
I just set up a new emacs installation, installed ELPA and installed swank-clojure with using ELPA. Although Clojure 1.2 is released, when I hit "M-x slime", it still downloaded Clojure 1.1 for me instead of 1.2
How do I get it to use 1.2 now that it's available? Do I have to do it manually? Do I have to wait for slime/swank to be updat...
McCarthy's Elementary S-functions and predicates were atom, eq, car, cdr, cons
He then went on to add to his basic notation, to enable writing what he called S-functions: quote, cond, lambda, label
On that basis, we'll call these "the LISP primitives" (although I'm open to an argument about type predicates like numberp)
How would you ...
How does one process large binary data files in Clojure? Let's assume data/files are about 50MB - small enough to be processed in memory (but not with a naive implementation).
The following code correctly removes ^M from small files but it throws OutOfMemoryError for larger files (like 6MB):
(defn read-bin-file [file]
(to-byte-array ...
I currently use Python for most of my programming, but I'm interested in learning Clojure. What libraries do I need to reproduce the functionality I have with scipy, numpy, and matplotlib? Is there anything like the Enthought distribution?
...
I am trying to create a map from an interleaved list and running into errors. Here is what I am doing:
(interleave ['a 'b] [1 2])
gives the list (a 1 b 2).
If I want to create a hash-map from a bunch of elements, I can do
(hash-map 'a 1 'b 2)
Combining the two together,
(hash-map ~@(interleave ['a 'b] [1 2]))
I get this error:
...
How to remove my jar from clojars? I don't want to mess up public group namespace. I want to move myproject/myproject to org.clojars.qertoip/myproject.
...
Whenever in Haskell we need some variant data type, we would use ADTs in conjunction with pattern matching. What do Clojure folks use for such usecases?
...
Ok Here is what i am trying to do
(defn addresses [person-id]
;addresses-retrival )
(defn person [id]
(merge {:addresses (addresses id)} {:name "john"}))
In the above person function i want addresses to be retrieved only on demand , like only when i do
(:addresses (person 10))
and not when
(person 10)
I am not sure if i ...
I have a function that works like that:
(the-function [one] [two] [three])
and I need a function that calls the-function.
I tried with [& args] but it doesn't seem to pass the arguments correctly.
If it helps, the-function is like the create-table of MySQL found here
EDIT:
my function that is not working is like this:
(defn my-fu...
I've been using emacs/slime for coding lisp, but with Clojure I found 'lein swank'.
I must say that it's pretty useful, as I can connect to a server that runs clojure.
How about the other Lisp implementations? What Lisp implementations provide the equivalent of 'lein swank' in Clojure? I mean, is there any other Lisp implementations th...
I have Aquamacs running on my Mac.
I installed the ESK for Aquamacs and it installs ELPA at ~/.emacs.d/elpa. With ELPA, I installed clojure-mode/clojure-est-mode/slime/slime-repl/swank-clojure.
The thing is that when I run 'M-x slime', clojure is run. Why is this? I'm curious as I don't have any setup for slime in my .emacs and even i...
My superficial understanding is that 'swank-clojure' makes 'M-x slime-connect' possible. I mean, it gives a connection to a clojure server something like 'lein swank'. Is my understanding correct? If not, what's the purpose of swank?
Then, is there any 'swank-SOMETHING_ELSE' for other lisp like implementations? For example, swank-clisp?...
What are the current choices of mature Clojure web frameworks? I am looking for some kind of feature matrix telling me what the popular frameworks support and to what extent, including:
Response templating (response written in Clojure or in some other markup - e.g. like JSP with Tiles)
HTTP sessions
REST with automatic mapping of URLs ...
Still trying to wrap my head around Clojure. I can see how to implement the following in Haskell, Python, etc. but do not yet understand how to write this in Clojure. Appreciate if someone can show me the basic structure. Pseudo-code below.
a = get_a
if (a == bad_value) then throw exception_a
b = get_b
if (b == bad_value) then throw exc...
Hi
It's just a stupid question that I had this morning : Can we use Scala classes from clojure ?
Because if the answer is yes, I'll definetly learn Clojure ^^
...