how to write a macro that calls defrecord?

2012-04-03 Thread Konrad Hinsen
Joachim De Beule writes: (defmacro my-defrecord [name [ fields] body]   `(defrecord ~name ~fields      MyProtocol      (do-something [this] this)      ~@body)) But then when I call  (my-defrecord R [content]),  which expands into the following (valid) code:

clj-http and boundary in the POST request

2012-04-03 Thread Jimmy
Hi all, The REST endpoint I need to call requires multiple boundaries in the POST request. Does any one know how to do this in clj-http? Lets say my header had the following boundary Content-Typemultipart/form-data; boundary=the_message_boundary How could i create a body with multiple

Problems with map of empty collections

2012-04-03 Thread JuanManuel Gimeno Illa
Playing with some problems of 4clojure, I wanted to make a map which, for each empty collection, returns a keyword. But it seems that it is impossible to have both an empty list and an empty vector in the same map. user= {() :list} {() :list} user= {() :list [] :vector} IllegalArgumentException

Re: Problems with map of empty collections

2012-04-03 Thread mnicky
Another interesting fact is that: Clojure 1.2.1 user= {'(1) :list [1] :vector} java.lang.IllegalArgumentException: Duplicate key: (1) (NO_SOURCE_FILE:0) Clojure 1.3.0 user= {'(1) :list [1] :vector} {(1) :vector} Clojure 1.4.0-beta1 user= {'(1) :list [1] :vector} {(1) :vector} ...but I don't

Re: Problems with map of empty collections

2012-04-03 Thread JuanManuel Gimeno Illa
More examples in clojure 1.3.0: user= {[1 2 3] :vector '(1 2 3) :list} {[1 2 3] :list} but user= #{[1 2 3] (1 2 3)} IllegalArgumentException Duplicate key: (1 2 3) clojure.lang.PersistentHashSet.createWithCheck (PersistentHashSet.java:68) ... anyone has an explanation? Juan Manuel On

Re: Initializers for AOTed deftype classes

2012-04-03 Thread Marshall T. Vandegrift
Marshall T. Vandegrift llas...@gmail.com writes: So, is this entirely expected behavior? Or am I missing something which would make initializing the defining namespace happen as part of a static initializer for the AOTed `deftype` class? To answer my own question, the Clojure wiki page on

Re: how to write a macro that calls defrecord?

2012-04-03 Thread Alex Miller
You might find this useful for examples: http://david-mcneil.com/post/765563763/enhanced-clojure-records On Monday, April 2, 2012 8:51:23 AM UTC-5, Joachim De Beule wrote: Hi All, I need to define a number of similar records, so I wanted to write a macro for that, but I do not know how.

Re: clj-http and boundary in the POST request

2012-04-03 Thread Lee Hinman
On Apr 3, 12:55 am, Jimmy jimmy.co...@gmail.com wrote: Hi all, The REST endpoint I need to call requires multiple boundaries in the POST request.  Does any one know how to do this in clj-http?  Lets say my header had the following boundary Content-Type    multipart/form-data;

Re: Need help to find a bug in a genetic algorithm

2012-04-03 Thread Marcus Lindner
Maybe the reason is the STM. If I rmember it correctly, then agents and refs are controlled by Clojures STM mechanic. Eventuelly the us of map increase the work for the STM and so it needs more time to schedule all the agent calls and this result in a higher memory usage. When you use pmap

Re: Need help to find a bug in a genetic algorithm

2012-04-03 Thread Jim - FooBar();
Hmmminteresting thoughts... I was under the impression that that agents are asynchronous and thus do not depend on the STM , which is only for co-ordinated change! There is a dedicated Thread pool where agents are assigned separate threads for their work.You seem to suggest otherwise...I

Re: Need help to find a bug in a genetic algorithm

2012-04-03 Thread Marcus Lindner
Might be. I have spent the last week to write some profiling code for the algorithm, which also calculates the memory usage. I wanted to try it out with the original code with different number of dimiciles and with the pmap code. But with the STM it is only a guess. I must reread the chapter

Re: Need help to find a bug in a genetic algorithm

2012-04-03 Thread Marcus Lindner
A short side note. I looked into The Joy of Clojure and there is a nice diagram on page 251 about the difference if you use send and send-off to send actions to an agent. The intersting on send is, that the agent queues the send actions if you use send. If you use send-off the agent does not

Re: Need help to find a bug in a genetic algorithm

2012-04-03 Thread Jim - FooBar();
The intersting on send is, that the agent queues the send actions if you use send. If you use send-off the agent does not stores the action into a queue. Yet the code uses send predominantly... On 03/04/12 18:39, Marcus Lindner wrote: Could be, that in the case of pmap a similiar effect

Re: Need help to find a bug in a genetic algorithm

2012-04-03 Thread Marcus Lindner
Yep. Your're right. Am 03.04.2012 20:04, schrieb Jim - FooBar();: The intersting on send is, that the agent queues the send actions if you use send. If you use send-off the agent does not stores the action into a queue. Yet the code uses send predominantly... On 03/04/12 18:39, Marcus

adding values to struct map

2012-04-03 Thread Vesna Petkovic
I've been looking for an answer for my problem on this group in vain. Found something that resolves part of the problem. I want to make a struct map like thi s (def events-for-mashup (let [title Events mashup event-data (vector create-map-of-events)] (struct event-map title

Re: adding values to struct map

2012-04-03 Thread Matjaz Gregoric
On Tue, Apr 3, 2012 at 8:15 PM, Vesna Petkovic vesna.petko...@gmail.comwrote: (def events-for-mashup (let [title Events mashup event-data (vector create-map-of-events)] (struct event-map title event-data))) It looks like you forgot to call your create-map-of-events function, try: (def

Re: adding values to struct map

2012-04-03 Thread Vesna Petkovic
Yes, you're right... it works now thanks On Tuesday, April 3, 2012 8:26:06 PM UTC+2, mtyaka wrote: On Tue, Apr 3, 2012 at 8:15 PM, Vesna Petkovic wrote: (def events-for-mashup (let [title Events mashup event-data (vector create-map-of-events)] (struct event-map title

Anybody interested in a Clojure Group in Rochester, NY?

2012-04-03 Thread Jeremy Heiler
I am wondering if anybody in (or near) Rochester, NY would be interested in forming a Clojure Group? I would like to think that there's more than just me hacking on Clojure in the area! -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this

Re: clj-http and boundary in the POST request

2012-04-03 Thread Jimmy
Hi Lee, Thanks for the suggestion, will try that approach. regards, Jimmy On Tuesday, April 3, 2012 4:30:10 PM UTC+1, Lee Hinman wrote: On Apr 3, 12:55 am, Jimmy jimmy.co...@gmail.com wrote: Hi all, The REST endpoint I need to call requires multiple boundaries in the POST request.

Great Lakes Functional Programming Conference

2012-04-03 Thread Onorio Catenacci
Hi all, If anyone was unaware, Dave Ray, author of the Seesaw Clojure library will be speaking at the inaugural Great Lakes Functional Programming Conference in Ann Arbor, MI on May 5. We're very pleased that Dave will be discussing Clojure development with us. More information here:

[ANN] Korma SQL ported to ClojureCLR

2012-04-03 Thread Aaron
I needed something quick like Korma for my .NET work, so I ported it to ClojureCLR. The code is here: https://github.com/aaronc/Korma.net. So far only MySql is supported. Right now, there is nothing like leiningen for .NET so no build and distribution yet. Also, most of the code for the JVM

Re: Need help to find a bug in a genetic algorithm

2012-04-03 Thread Stefan Kamphausen
Hi, sorry to be late to the party... Please let me try to answer some of your questions in one post. 1. The main purpose for the code was to show how many threads could work on one shared data-structure and how the introduction of concurrent programming can change the algorithms: in this case

Re: Need help to find a bug in a genetic algorithm

2012-04-03 Thread Jim - FooBar();
Wow that is indeed very clear and informative...Thanks a lot! I could not agree more! I was struggling to understand the 'meaning' of the algorithm and what it was trying to demonstrate...as Stefan said, one would expect the most expensive bit in any evolutionary computation to be the

Re: Anybody interested in a Clojure Group in Rochester, NY?

2012-04-03 Thread Justin Kramer
Hi Jeremy, There's a RocLisp group that meets once in a while (next meeting TBD). We've been focussing on Clojure so far. http://roclisp.org/ https://github.com/roclisp Twitter: @roclisp I myself am pretty nuts about Clojure. Looking forward to meeting and hacking with you, Justin @jkkramer

Re: Problems with map of empty collections

2012-04-03 Thread Stuart Campbell
I think quoting plays a part here: Clojure 1.3.0 user= {(list 1 2 3) :list [1 2 3] :vec} IllegalArgumentException Duplicate key: (1 2 3) clojure.lang.PersistentArrayMap.createWithCheck (PersistentArrayMap.java:70) Stuart On 3 April 2012 22:41, JuanManuel Gimeno Illa jmgim...@gmail.com wrote:

Re: Anybody interested in a Clojure Group in Rochester, NY?

2012-04-03 Thread Jeremy Heiler
Awesome! Thanks Justin. I'll introduce myself on the list. I look forward to meeting you and the rest. On Tue, Apr 3, 2012 at 6:49 PM, Justin Kramer jkkra...@gmail.com wrote: Hi Jeremy, There's a RocLisp group that meets once in a while (next meeting TBD). We've been focussing on Clojure so

Re: Clojure Toolbox

2012-04-03 Thread Glen Stampoultzis
Also... http://clojure-libraries.appspot.com On 24 March 2012 23:45, Rostislav Svoboda rostislav.svob...@gmail.comwrote: A nice list of tools and libraries I stumbled upon. Enjoy! http://www.clojure-toolbox.com/ -- You received this message because you are subscribed to the Google Groups

Help with this error and comment.

2012-04-03 Thread uMany
Hi everybody Everything was working great and just today, while trying to make a simple lein new foobar I got this error: Exception in thread main java.lang.IllegalAccessError: render does not exist (default.clj:1) at clojure.lang.Compiler.eval(Compiler.java:5440) at

Help with this error and comment.

2012-04-03 Thread uMany
Hi everybody Everything was working great and just today, while trying to make a simple lein new foobar I got this error: Exception in thread main java.lang.IllegalAccessError: render does not exist (default.clj:1) at clojure.lang.Compiler.eval(Compiler.java:5440) at

Re: Help with this error and comment.

2012-04-03 Thread Cedric Greevey
On Tue, Apr 3, 2012 at 11:39 PM, uMany elm...@gmail.com wrote: Hi everybody Everything was working great and just today, while trying to make a simple lein new foobar I got this error: Exception in thread main java.lang.IllegalAccessError: render does not exist (default.clj:1) The JVM is

Re: Need help to find a bug in a genetic algorithm

2012-04-03 Thread Marcus Lindner
Thanks for the answer. I wondered too why the GA took so long to solve this small problem. I tried send for the grimreaper, but this does not solve the population increase problem. On a test run the population even increses much faster, wehen I used only send. But I must say I liked the idea