Re: Macro newbie: Trying to create a map template

2009-10-23 Thread John Harrop
On Sat, Oct 24, 2009 at 12:19 AM, samppi wrote: > user=> (defmacro b [form] > (let [processed-form (a form rec#)] >`(fn [rec#] processed-form))) > java.lang.Exception: Unable to resolve symbol: rec# in this context > (NO_SOURCE_FILE:39) Try (defmacro b [form] (let [r (gensym) pr

Macro newbie: Trying to create a map template

2009-10-23 Thread samppi
I'm trying to create a macro called "procedure" so that: (procedure (and _x (pos? _y))) expands to (fn [rec#] (and (:x rec#) (pos? (:y rec# I'm stuck because I can't figure out a way to generate a symbol outside. I'm a newbie at macros, so I don't know if there's a better way around this:

Re: Why can't :let be first in a for

2009-10-23 Thread Meikel Brandmeyer
Hi, Am 23.10.2009 um 21:16 schrieb Howard Lewis Ship: > Here's what I wanted to write: > > (defn add-script-links-for-imported-javascript-libraries > [env dom-nodes] > (extend-dom dom-nodes [:html :head] :top > (template-for [:let [aggregation (-> env :cascade :resource-

Re: Why can't :let be first in a for

2009-10-23 Thread Chouser
On Fri, Oct 23, 2009 at 3:16 PM, Howard Lewis Ship wrote: > > I like to try and keep my level of nesting under control, and this > often involves hiding or re-structuring the let macro. The for macro > can implicitly assemble a let macro for you, but with a limitation > that the :let clause can't

Re: Scientific computing

2009-10-23 Thread Garth Sheldon-Coulson
Hi Rock, Clojure isn't designed as an array processing language, so it doesn't have multidimensional array-slicing or matrix algebra tools built in. That's just not what Clojure's trying to be, and you're right, immutable data structures might get in the way. There's probably nothing stopping you

Re: Scientific computing

2009-10-23 Thread Konrad Hinsen
re is little practial experience with this at the moment. Konrad. __ Information provenant d'ESET NOD32 Antivirus, version de la base des signatures de virus 4537 (20091023) __ Le message a été vérifié par ESET NOD32 Antivirus. http://www.eset.com --~--~-~--~

Why can't :let be first in a for

2009-10-23 Thread Howard Lewis Ship
I like to try and keep my level of nesting under control, and this often involves hiding or re-structuring the let macro. The for macro can implicitly assemble a let macro for you, but with a limitation that the :let clause can't be first: 1:5 user=> (for [:let [z [:foo :bar]] x z] (name x)) java

Re: Clojure in a big Java solution

2009-10-23 Thread Luc Prefontaine
If the Java layers are not already thread safe, you are facing a real problem if you just try to layout some Clojure code on top of them... You would have to be careful about isolating chunks that are thread safe then look at what's left. The difficulty then would be to find a way to introduce Clo

Writing binary data using http.agent and duck-streams

2009-10-23 Thread Baishampayan Ghose
Hello, I was trying to download a zip file using clojure.contrib.http.agent and writing it to a file using clojure.contrib.duck-streams. Apparently the zip file is getting corrupt because I was trying to treat the stream as a string. Is there any way to use duck-streams to write data as binary?

Scientific computing

2009-10-23 Thread Rock
What if I wanted to use Clojure for scientific computing, and in particular for doing linear algebra and matrix computations a la MATLAB? What would my options be for representing matrices, not to mention, especially, MULTIDIMENSIONAL ARRAYS? Would java arrays be the way to go, or nested vectors

Re: Removing duplication of redis/with-server in every function?

2009-10-23 Thread Kevin Downey
I think the point of this style of api is you just define your functions like (defn one [] ) (defn two [] ) and call the function like (redis/with-server *db* (one) (two)) On Thu, Oct 22, 2009 at 2:44 PM, Radford Smith wrote: > > I'm trying out redis-clojure. Right now, my code looks li

Re: Removing duplication of redis/with-server in every function?

2009-10-23 Thread Jonathan Smith
When figuring these things out it can sometimes help to look at the implementations of stuff like defn (in clojure.core). I'll leave it as an exercise to you, but you should note that you may want to name-space qualify the database (depending on what you are doing with it and where the database s

Clojure in a big Java solution

2009-10-23 Thread vanallan
Hi! I am currently investigating if it is possible to convert a part of a big Java system to Clojure. The reason for this is to make this part run in parallel and hence ease the implementation by porting it to Clojure. The problem is that these parts of the system is today setting and changing a l

Re: Private multimethods possible?

2009-10-23 Thread Meikel Brandmeyer
Hi, On Oct 23, 8:45 am, Christophe Grand wrote: > Other solutions are to use @#'ns/private-var to access private vars from the > macro or to make the macro shallow using a public (usually higher-order) > helper function (is this possible in the general case?). It is not 100% possible in the ge