Re: Macro Design - by example

2009-06-09 Thread Laurent PETIT
Good ! Do you consider putting this on the clojure wikibook ? Cheers, -- Laurent 2009/6/8 Meikel Brandmeyer : > Dear Clojurians, > > in the past there were several discussions on the list > regarding the one or the other macro. Please let me > show some design principles, which I believe are

Re: Macro Design - by example

2009-06-09 Thread Daniel Lyons
On Jun 8, 2009, at 3:50 PM, Meikel Brandmeyer wrote: > And now you can track the event passing. Eh.. well.. > Not quite! First you have to recompile all your code > and restart the application. Since a macro gets > expanded at compile time, there is no way to change > the expansion afterwards.

Clojure, GridGain and serialization error

2009-06-09 Thread prhlava
Hello, I am playing with GridGain http://www.gridgain.com from Clojure and I am getting exception related to serialization. >>> Type: org.gridgain.grid.GridException >>> Message: Failed to deserialize object with given class loader: >>> clojure.lang.dynamicclassloa...@667cbde6 (the full stack

macro escapes and passing method names are function arguments

2009-06-09 Thread Josh Smith
I've been trying to understand the macro syntax in clojure. I think macro's are closer to the kind of functionality I'm looking for (as opposed to multi-methods) but I'm not sure. http://gist.github.com/126315 I wrote the above code, which simply processes Java-style Properties files (using the

Re: macro escapes and passing method names are function arguments

2009-06-09 Thread Parth
On Jun 9, 11:50 am, Josh Smith wrote: > I've been trying to understand the macro syntax in clojure.  I think > macro's are closer to the kind of functionality I'm looking for (as > opposed to multi-methods) but I'm not sure. > > http://gist.github.com/126315 > Hi Josh, As a general recommend

Re: The "->" & "." nested usage

2009-06-09 Thread Andrew Wagner
So there's a different macro analogous to "String." for a bunch of different classes, and it doesn't work for arbitrary classes? On Tue, Jun 9, 2009 at 2:55 AM, Konrad Hinsen wrote: > > On 08.06.2009, at 21:59, Andrew Wagner wrote: > > > Just to be clear, is (String.) a macro? I thought it was ju

Re: The "->" & "." nested usage

2009-06-09 Thread Christophe Grand
Andrew Wagner a écrit : > So there's a different macro analogous to "String." for a bunch of > different classes, and it doesn't work for arbitrary classes? It works for arbitrary classes. Any symbol that ends with a dot macroexpands to a 'new form. => (macroexpand '(AndrewWagner.)) (new Andrew

Re: The "->" & "." nested usage

2009-06-09 Thread Meikel Brandmeyer
Hi, Am 09.06.2009 um 12:57 schrieb Andrew Wagner: So there's a different macro analogous to "String." for a bunch of different classes, and it doesn't work for arbitrary classes? Any Symbol ending in a dot is treated as macro expanding into (new TheSymbol). Similar Symbols starting in a dot

Re: macro escapes and passing method names are function arguments

2009-06-09 Thread Laurent PETIT
Hi, 2009/6/9 Josh Smith : > > I've been trying to understand the macro syntax in clojure.  I think > macro's are closer to the kind of functionality I'm looking for (as > opposed to multi-methods) but I'm not sure. > > http://gist.github.com/126315 I second Parth concerning the usage of macros

Re: Thoughts on bags?

2009-06-09 Thread AndrewC.
On Jun 9, 7:49 am, Konrad Hinsen wrote: > On 09.06.2009, at 07:31, Richard Newman wrote: > > > Has there been any thinking about supporting a 'bag' sibling of 'set', > > and allowing it to be passed correctly through the relational > > operators? Right now I have a choice between rephrasing my co

Re: macro escapes and passing method names are function arguments

2009-06-09 Thread Meikel Brandmeyer
Hi, Am 09.06.2009 um 08:50 schrieb Josh Smith: I've been trying to understand the macro syntax in clojure. I think macro's are closer to the kind of functionality I'm looking for (as opposed to multi-methods) but I'm not sure. Ask yourself the following question: Does what you want

Re: Bug report -- macros within let [Re: Bizarre behavior (bug?) for unchecked-add]

2009-06-09 Thread Laurent PETIT
Thinking about it again, Is qualifying this as a non-bug, a known limitation the best that can be said about it ? Could the implementation be improved to handle this case, or is there a theoretical reason I've not thought about that prevents doing this for the general case ? Thanks, -- Lauren

(Simple) Neural Net Simulation

2009-06-09 Thread alfred.morgan.al...@gmail.com
I'm pretty well a complete beginner at clojure, but I was hoping I could get some advice on how to do this sort of thing efficiently/ concisely, because as far as I can tell this involves handling an awful lot of heavily mutable state, so right now I really feel like I'm fighting the language. Wh

Re: performance concerns (again)

2009-06-09 Thread Jonah Benton
Snippets responded to below... On Mon, Jun 8, 2009 at 5:43 PM, Robert Lehr wrote: > > I executed a simpler test in Java only, one that prints a simple > "Sleeping 30sec" message then sleeps for 30sec.  The 30sec delay is so > that I can record the memory allocated by JVM. > >    * on a Windows XP

Clojure at LispNYC tonight 7pm

2009-06-09 Thread Stuart Sierra
Join us Tuesday, June 9 from 7:00-9:00 for Stuart Sierra's presentation: Implementing AltLaw.org in Clojure This talk demonstrates the power of combining Clojure with large Java frameworks, such as: * Hadoop - distributed map/reduce processing * Solr - text indexing/search

Re: performance concerns (again)

2009-06-09 Thread Kyle Schaffrick
On Fri, 5 Jun 2009 02:18:53 -0700 (PDT) Robert Lehr wrote: > > The problem was that it was not as fast as I expected it should be > given that it was using no less than 100% of the CPU on my system. > (two 3GHz Xeon CPUs [1 core]; 3GB RAM; a beefy workstation). That > this was visible in the GU

Re: clojure.contrib.except enhanced

2009-06-09 Thread Stephen C. Gilardi
On Jun 6, 2009, at 3:39 PM, Chouser wrote: On Sat, Jun 6, 2009 at 10:42 AM, Stephen C. Gilardi wrote: I've checked in changes to clojure.contrib.except to allow the functions it provides to produce exceptions that wrap other exceptions: they now support "causes". I believe it's now fully

Re: (Simple) Neural Net Simulation

2009-06-09 Thread Konrad Hinsen
On Jun 9, 2009, at 14:59, alfred.morgan.al...@gmail.com wrote: > I'm pretty well a complete beginner at clojure, but I was hoping I > could get some advice on how to do this sort of thing efficiently/ > concisely, because as far as I can tell this involves handling an > awful lot of heavily mutab

Re: filechooser

2009-06-09 Thread Emeka
- line 35 looks wrong. What does Dispatch/put return Thanks so pointing that out. I have to out windows guys then. Regards, Emeka --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this grou

Help with filechooser

2009-06-09 Thread Emeka
Hello All, (add-item-action ost-item (do (.showOpenDialog file-chooser frame) (let [file (.getSelectedFile file-chooser)] (println "file" file When I tried the above on windows box it prints file #. But what I want is "file C:\clojure\roobot.txt". Regards, Emeka

Re: Help with filechooser

2009-06-09 Thread Emeka
Sorry for the noise, I was too quick. On Tue, Jun 9, 2009 at 3:46 PM, Emeka wrote: > Hello All, > > (add-item-action ost-item (do > (.showOpenDialog file-chooser frame) > (let [file (.getSelectedFile file-chooser)] > (println "file" file > > > When I tried the

Re: (Simple) Neural Net Simulation

2009-06-09 Thread alfred.morgan.al...@gmail.com
Thanks for the advice, but at present I'm simply aiming to get the very basics of a neural net up and running without having to worry about a training algorithm at all. Here's what I have so far (again, very basic) ;; Net0 (def nodes {}) (defn insertNode [node] (do (def nodes (assoc nodes (

Re: Help with filechooser

2009-06-09 Thread BrianS
Emeka, Your 'file' is an actual file. What you want is it's name. I think the last line should look like this: (println (str "file " (.getName file) I worked on my Mac, I assume it will work in Windows. Brian On Jun 9, 11:53 am, Emeka wrote: > Sorry for the noise, I was too quick. > > On

Re: Clojure, GridGain and serialization error

2009-06-09 Thread prhlava
> I am playing with GridGain http://www.gridgain.com from Clojure and I > am getting > exception related to serialization. Never mind, I tool a wrong approach at first. Now I have it running, apologies for the noise... Kind regards, Vlad --~--~-~--~~~---~--~~ You

Monad problem in c.c svn 926

2009-06-09 Thread Sean Devlin
I was trying to play with the monad facility in c.c. I'm using Aquamacs & SLIME, and I ran into the following problem: user=> (use 'clojure.contrib.monads) java.lang.Exception: Unable to resolve symbol: get-method in this context (accumulators.clj:60) I think this is a bug. Not sure, though.

How is Clojure API reference generated?

2009-06-09 Thread Nicolas Buduroi
Hi, I'm wondering how Clojure API reference page is generated? I'd like to adapt it for the future Compojure website if possible. On another note, how is Clojure website built and what language/framework does it use? Thanks - budu --~--~-~--~~~---~--~~ You receive

Re: Clojure, GridGain and serialization error

2009-06-09 Thread ataggart
What was the solution? On Jun 9, 1:03 pm, prhlava wrote: > > I am playing with GridGainhttp://www.gridgain.comfrom Clojure and I > > am getting > > exception related to serialization. > > Never mind, I tool a wrong approach at first. Now I have it running, > apologies for the noise... > > Kind r

Re: (Simple) Neural Net Simulation

2009-06-09 Thread ataggart
On Jun 9, 11:07 am, "alfred.morgan.al...@gmail.com" wrote: > Thanks for the advice, but at present I'm simply aiming to get the > very basics of a neural net up and running without having to worry > about a training algorithm at all.  Here's what I have so far (again, > very basic) > > ;; Net0

Reading files with nio.

2009-06-09 Thread Nicolas Buduroi
Hi, I've been playing with nio lately and it's been quite fun to delve in lower level stuff again, didn't do that in a long time. I've translated a small example, just to read a file, and the result is performing really well. Here's the code: (defn read-file [#^String f #^String cs #^Integer buff

Re: (Simple) Neural Net Simulation

2009-06-09 Thread Asbjørn Bjørnstad
On Jun 10, 2:07 am, "alfred.morgan.al...@gmail.com" wrote: > Thanks for the advice, but at present I'm simply aiming to get the > very basics of a neural net up and running without having to worry > about a training algorithm at all.  Here's what I have so far (again, > very basic) > > ;; Net0

Re: You know you've been writing too much Clojure when...

2009-06-09 Thread Sean Devlin
You're writing an email and ;Rich Hickey is a no good... comment out a line instead of deleting it :) (Fortunately I caught this before I hit send) On Jun 4, 8:48 am, BrianS wrote: > You see a license plate in front of you DEFN1A3F and you wonder what > the function 1A3F would return...ha

Re: (Simple) Neural Net Simulation

2009-06-09 Thread Asbjørn Bjørnstad
On Jun 10, 9:55 am, Asbjørn Bjørnstad wrote: > (defn connect-node [m a b weight] >   (update-in (update-in m [a :outputs] >                         assoc b weight) >              [b :inputs] assoc a weight)) Ugh... Looks better this way: (defn connect-node [m a b weight] (-> m (upda

"Programming Clojure",

2009-06-09 Thread Robert Lehr
I am familiarizing myself w/ Clojure with Stuart Holloway's book, "Programming Clojure". A great introduction to Clojure - very helpful. ASIDE - this actually makes me wonder...are add'l books about Clojure currently being written? If nobody else knows, RH probably would. While reading the "Pr

Re: Thoughts on bags?

2009-06-09 Thread Richard Newman
Thanks, Konrad and Andrew, for chipping in! >> There's an outline of an implementation of multisets (I think that's >> the same as your bags) at: >> >>http://code.google.com/p/clojure-contrib/source/browse/trunk/src/ >> clojure/contrib/types/examples.clj Thanks for the pointer. I apolog

agent questions - DOS - asynchrony - protection

2009-06-09 Thread Robert Lehr
STUPID QUESTION TIME and another long post - sorry. Q - What stops Clojure's agent send-off function from becoming a DOS ("denial of service") vulnerability in a server? This possibility occurred to me after reading several source files. * Stuart Sierra's HTTP client code in clojure-contri

Re: Thoughts on bags?

2009-06-09 Thread Kevin Downey
On Tue, Jun 9, 2009 at 7:49 PM, Richard Newman wrote: > > Thanks, Konrad and Andrew, for chipping in! > >>> There's an outline of an implementation of multisets (I think that's >>> the same as your bags) at: >>> >>>        http://code.google.com/p/clojure-contrib/source/browse/trunk/src/ >>> cloju

Re: Thoughts on bags?

2009-06-09 Thread Daniel Lyons
On Jun 9, 2009, at 8:49 PM, Richard Newman wrote: > For now, as I'm storing maps in my sets -- I'm doing relational stuff, > after all -- I just add an :id entry in each map, filled by (iterate > inc 0). Functionally the same as a multiset, so long as I ignore > the :id 'column'... I am very f

Re: (Simple) Neural Net Simulation

2009-06-09 Thread Jeff Foster
I'm playing around with neural networks and went for a functional approach. There's some code at http://github.com/fffej/ClojureProjects/tree/master in the neural-networks directory. See http://www.fatvat.co.uk/2009/06/back-propagation-algorithm-in-clojure.html for some explanation. Lack of mu

Re: Thoughts on bags?

2009-06-09 Thread Richard Newman
> I am very fond of the relational functions in Clojure. That was one of > the first things that started winning me over actually. Indeed, they're very nice to have! > Forgive me if this is an obvious question, but what exactly is the > disadvantage of the add-an-id approach? It's largely aesth

Re: agent questions - DOS - asynchrony - protection

2009-06-09 Thread Daniel Lyons
Robert, You have some interesting questions. I'm going to share my impressions of the answers based on reading the website and the book. I am rather new to Clojure myself and I haven't read the source code to it so perhaps any mistakes I make are representative of newbie pitfalls in gener

Re: Monad problem in c.c svn 926

2009-06-09 Thread Konrad Hinsen
On 09.06.2009, at 23:48, Sean Devlin wrote: > I was trying to play with the monad facility in c.c. I'm using > Aquamacs & SLIME, and I ran into the following problem: > > user=> (use 'clojure.contrib.monads) > java.lang.Exception: Unable to resolve symbol: get-method in this > context (accumulat

Re: Monad problem in c.c svn 926

2009-06-09 Thread Sean Devlin
Hmmm... I just tested this in Enclojure. use works fine there. Still doesn't work on my Aquamacs/SLIME setup. I'll check my config. On Jun 10, 2:14 am, Konrad Hinsen wrote: > On 09.06.2009, at 23:48, Sean Devlin wrote: > > > I was trying to play with the monad facility in c.c.  I'm using > >

Re: (Simple) Neural Net Simulation

2009-06-09 Thread Konrad Hinsen
On 09.06.2009, at 20:07, alfred.morgan.al...@gmail.com wrote: > Thanks for the advice, but at present I'm simply aiming to get the > very basics of a neural net up and running without having to worry > about a training algorithm at all. Here's what I have so far (again, > very basic) > > > ;; Ne

Re: Thoughts on bags?

2009-06-09 Thread Konrad Hinsen
On 10.06.2009, at 04:49, Richard Newman wrote: > The cardinality tracking has been (necessarily, I understand) lifted > into the explicit contents of the data structure, so applications > which call Clojure code that performs core operations (not your > generic versions) on those structures will

Re: agent questions - DOS - asynchrony - protection

2009-06-09 Thread Robert Lehr
Thanks, Daniel. See responses inline. On Jun 10, 2:10 am, Daniel Lyons wrote: > Robert, > > You have some interesting questions. I'm going to share my impressions   > of the answers based on reading the website and the book. I am rather   > new to Clojure myself and I haven't read the source co