Re: agents sending-off to other agents blocks?

2010-06-16 Thread Rasmus Svensson
2010/6/12 Dan Larkin d...@danlarkin.org Does anyone have insight as to the reasoning here? Is it a bug? If it's intended behavior is there something I can do to circumvent it? I do think this is intentional. Agents holding on to their sends until its state transition function is done can be

Re: agents sending-off to other agents blocks?

2010-06-16 Thread Meikel Brandmeyer
Hi, On Jun 16, 12:56 pm, Rasmus Svensson r...@lysator.liu.se wrote: One solution to the sleep problem could perhaps be to let the agent send this to it self: (fn [state millis]   (Thread/sleep millis)   state) With this one has to keep in mind, that maybe someone else has already sent

Re: agents sending-off to other agents blocks?

2010-06-16 Thread Moritz Ulrich
Yup, I think the transactional semantics are the main cause of this behavior. Aren't send and send-off doing the same thing during a real transaction in a ref? To fight the issue of repeating send if the transaction gets retried. On Wed, Jun 16, 2010 at 1:05 PM, Meikel Brandmeyer m...@kotka.de

Re: Serious problem with underive (for hierarchies), an attempt to fix, and request for code review.

2010-06-16 Thread Stuart Halloway
Hi Rob, Thanks for tracking this down. If you will execute a CA [1], I would love to get a patch (with tests) that fixes this. I have created a ticket at [2] to track it. I would prefer something along the lines of the simpler fix shown below, unless anybody pops up on this thread with a

Re: Non-tail recursion (Clojure way to hierarchies)

2010-06-16 Thread Quzanti
Thanks James. If any one else is as new to functional stuff as me then I found this in Paul Graham's book which enables me to reason logically about the matter (hopefully) A good compiler can compile a tail call into a goto, and so can compile a tail recursive function into a loop. In typical

Gwt-Clojure - lightweight browser implementation

2010-06-16 Thread pfisk
Gwt-Clojure is a subset of the Clojure language which was developed for scripting GWT (Google Windows Toolkit) widgets in the browser environment. It is designed to be able to share code with Clojure running on the server. The current deployment size is about 145kb of Javascript - including the

Re: working with agents and atoms - a beginner question

2010-06-16 Thread Ryan Waters
On Tue, Jun 15, 2010 at 12:23 PM, Shawn Hoover shawn.hoo...@gmail.com wrote: On Tue, Jun 15, 2010 at 12:01 PM, Ryan Waters ryan.or...@gmail.com wrote: I'm working with the code at the following gist and also pasted below: http://gist.github.com/421550 I'd like to have execution of a

Re: working with agents and atoms - a beginner question

2010-06-16 Thread Ryan Waters
Thank you for pointing that out. I notice your style is similar to Rich's in his ant.clj [1] which seems like the kind of solution that might be used in other functional and/or lisp languages. Do you know if that's the case with self-calling functions and agents? However, isn't there more

Re: Complex type in clojure

2010-06-16 Thread Eric Krohn
Mathematicians traditionally use i and engineers traditionally use j to represent the square root of -1. Travis undoubtedly wanted to keep both happy. -- Eric Krohn Sorry I may have missed the reason for this earlier: What's the reason for allowing both 'i' and 'j' to indicate the imaginary

Re: New Clojure web application launched: DocuHarvest

2010-06-16 Thread Jim Blomo
Thanks, very helpful. I hadn't heard of clutch before your announcement, so I appreciate the introduction. The clojure view server sounds especially interesting! Jim On Tue, Jun 15, 2010 at 12:51 PM, Chas Emerick cemer...@snowtide.com wrote: Last I looked (and it appears to be the same way

Re: Complex type in clojure

2010-06-16 Thread Travis Hoffman
We Electrical Engineers are quite annoying in this regard, but historically, there is much variation out there: Python uses j, MATLAB accepts i or j. Apache Commons allows the user to specify the specific character to use, but defaults to i I believe. Eventually, I would suggest this be a

Re: Can anyone create a simpler version of prime factors in Clojure?

2010-06-16 Thread Daniel
Here's my awful terrible code which is a direct translation from a java version I wrote and needs a fast functional sieve: I prefer Cristophe Grande's. http://clj-me.cgrand.net/index.php?s=Everybody%20loves%20the%20Sieve%20of%20Eratosthenes The one in contrib is pretty good as well. (letfn

Re: Serious problem with underive (for hierarchies), an attempt to fix, and request for code review.

2010-06-16 Thread YD
The problems are real. Well done! -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe

Re: Serious problem with underive (for hierarchies), an attempt to fix, and request for code review.

2010-06-16 Thread YD
Another apporach I think would be modifying the data structure of hierarchy itself. The idea is to add a counter to ancestors and descendants. :ancestors: { :c #{ [:a1 1] [:a2 2] } } So, the counter 2 on :a2 means how many paths can you get :c to reach :a2. When the counter reaches 0, you can

Re: working with agents and atoms - a beginner question

2010-06-16 Thread Ryan Waters
On Wed, Jun 16, 2010 at 12:17 AM, Christophe Grand christo...@cgrand.net wrote: Hi Ryan, On Tue, Jun 15, 2010 at 6:01 PM, Ryan Waters ryan.or...@gmail.com wrote: I'm working with the code at the following gist and also pasted below: http://gist.github.com/421550 I'd like to have execution

Re: agents sending-off to other agents blocks?

2010-06-16 Thread YD
Yeah, it's intended, just like what Ulrich showed. The same comment appears on the doc of release-pending-sends. In your case, the inner send-off doesn't rely on the result of the outter send-off. So, you can use release-pending-sends. The following code will have hey printed right away. (send

Passing Arguments From Java to Clojure

2010-06-16 Thread allie
There's a canonical intro on how to call or embed Clojure into Java: http://en.wikibooks.org/wiki/Clojure_Programming/Tutorials_and_Tips#Invoking_Clojure_from_Java While this is a great introduction, the only thing Java passes in to Clojure here is a string. I've tried methods where Java passes

Re: Why does clojure-http stores cookies in a ref instead of an atom

2010-06-16 Thread Steve Molitor
Thanks for the reply. I wasn't trying to be critical. I have a similar situation where I'm using an atom instead of a ref, and wanted to make sure I wasn't missing anything in my understanding of refs vs. atoms. I am using clojure-http currently and it works quite well, thank you! It's very

Re: working with agents and atoms - a beginner question

2010-06-16 Thread Meikel Brandmeyer
Hi, Am 15.06.2010 um 23:27 schrieb Ryan Waters: Thank you for pointing that out. I notice your style is similar to Rich's in his ant.clj [1] which seems like the kind of solution that might be used in other functional and/or lisp languages. Do you know if that's the case with self-calling

Re: working with agents and atoms - a beginner question

2010-06-16 Thread Christophe Grand
On Wed, Jun 16, 2010 at 10:20 PM, Meikel Brandmeyer m...@kotka.de wrote: The typical solution for your problem would probably be: (- long-running-function-with-recur Thread. .start) This starts you function in a dedicated thread and you can save the overhead of send-off and use recur

Re: working with agents and atoms - a beginner question

2010-06-16 Thread Meikel Brandmeyer
Hi, Am 16.06.2010 um 22:34 schrieb Christophe Grand: I agree, it still feels a little dirty to use a future without caring about the return value but on the positive said you get an easy way to block and wait for the tread to finish (deref) and you also get future-done?, future-cancel and

Re: Gwt-Clojure - lightweight browser implementation

2010-06-16 Thread nickikt
That looks really cool. I want to do some webstuff with clojure soon and I have to look at your stuff more then and I have to read a bit about GWT never heard of it until now. On 15 Jun., 20:48, pfisk peter.f...@gmail.com wrote: Gwt-Clojure is a subset of the Clojure language which was developed

Re: Serious problem with underive (for hierarchies), an attempt to fix, and request for code review.

2010-06-16 Thread Rob Lachlan
Hi Stuart, I'll be mailing the agreement later today, and I'll work on a patch shortly. I've noticed that the unit tests file for multi-methods, where tests for derive and underive would be located, is essentially empty. So I thought I might put some tests in there for isa, parents, ancestors,

basic help with netbeans/enclojure installation

2010-06-16 Thread Lee Spector
Starting from scratch, both to try it myself and to know what to tell my students in the fall, when I'll want them all (regardless of background) to be able to set up a reasonable Clojure environment without hassles. I've never previously used netbeans. I'm doing this on a Mac running MacOS

Re: Serious problem with underive (for hierarchies), an attempt to fix, and request for code review.

2010-06-16 Thread Rob Lachlan
I like the reference counting idea, YD. I don't think that we want to go that route, though, if underive will be called comparatively rarely by most people. But it would be a good way to do it if that performance were needed. Rob On Jun 15, 10:39 pm, YD ydong.pub...@gmail.com wrote: Another

Re: basic help with netbeans/enclojure installation

2010-06-16 Thread eyeris
Which version of NetBeans did you install? Version 6.9 (the version linked to on the netbeans.org front page) was released very recently. It's unlikely that Enclojure has been updated for NetBeans 6.9. On Jun 16, 5:29 pm, Lee Spector lspec...@hampshire.edu wrote: Starting from scratch, both to

Re: Passing Arguments From Java to Clojure

2010-06-16 Thread Daniel
Actually, just look at the main method (for testing) which has been commented out at the bottom - that will show you a better way to create and use it. On Jun 16, 9:37 am, allie allison.terr...@gmail.com wrote: There's a canonical intro on how to call or embed Clojure into

Re: Passing Arguments From Java to Clojure

2010-06-16 Thread Stuart Halloway
Do you really need a Clojure vector-of-vectors, or do you just want an indexed collection of indexed collections? If the latter, you can simply use Java arrays, or ArrayMaps. ; build a collection a Java programmer might have made ; (I am not really going to go into Java just for an example...

Re: Hash-map destructuring

2010-06-16 Thread ataggart
There's a disconnect between the function definition and the datastructures used by the caller. Either fix the data structure: (def args [:bar 2 :baz [:quux]]) then use apply Or change the function definition to take a map: (defn foo [x {:keys [bar baz]}] ...) On Jun 16, 4:00 pm, Brian

Re: Passing Arguments From Java to Clojure

2010-06-16 Thread rzeze...@gmail.com
-- CallClojure.java -- import clojure.lang.RT; import clojure.lang.Var; import clojure.lang.PersistentVector; public class CallClojure { static PersistentVector toVec(int[][] arr) { PersistentVector pv = PersistentVector.EMPTY; for (int[] a : arr) {

Re: agents sending-off to other agents blocks?

2010-06-16 Thread Dan Larkin
Ah thanks for pointing out release-pending-sends, I didn't know about that; it's exactly what I need in my case. On Jun 16, 2010, at 9:52 AM, YD wrote: Yeah, it's intended, just like what Ulrich showed. The same comment appears on the doc of release-pending-sends. In your case, the inner

Re: Hash-map destructuring

2010-06-16 Thread Michael Gardner
On Jun 16, 2010, at 7:07 PM, ataggart wrote: There's a disconnect between the function definition and the datastructures used by the caller. Either fix the data structure: (def args [:bar 2 :baz [:quux]]) then use apply Or change the function definition to take a map: (defn foo [x

Problems with URL params and http-agent

2010-06-16 Thread Timothy Washington
Hey all, something very weird happens when trying to use the http-agent. If I execute a) or b) in a browser, I get the desired result XML. a) http://RESTful/path/to/xml b) http://RESTful/path/to/xml?_wrap=no_query=declare default element namespace 'com/interrupt/bookkeeping/users';//user[

Recommendations on prepping a library for 1.2 release?

2010-06-16 Thread Richard Lyman
I guess I'm mostly wondering where to get the best (continually update-able best) version of 1.2 core (and contrib?) before it's released. I'd rather not go Lein or Maven2 - just a vanilla checkout and Ant if that's still a supported build option. Everything's on github - right? The simplest

Re: Recommendations on prepping a library for 1.2 release?

2010-06-16 Thread David Nolen
On Wed, Jun 16, 2010 at 10:17 PM, Richard Lyman richard.ly...@gmail.comwrote: Everything's on github - right? The simplest commands to grab the core (and contrib?) from github as well as the commands to keep updating every week or so until release would be fantastic. git clone url, to get it

Re: Complex type in clojure

2010-06-16 Thread Carson
Thanks. It's always interesting to see different notations. On Jun 15, 4:49 pm, Travis Hoffman travis.a.hoff...@gmail.com wrote: We Electrical Engineers are quite annoying in this regard, but historically, there is much variation out there: Python uses j, MATLAB accepts i or j. Apache Commons

Re: Recommendations on prepping a library for 1.2 release?

2010-06-16 Thread Richard Lyman
On Wed, Jun 16, 2010 at 8:36 PM, David Nolen dnolen.li...@gmail.com wrote: On Wed, Jun 16, 2010 at 10:17 PM, Richard Lyman richard.ly...@gmail.com wrote: Everything's on github - right? The simplest commands to grab the core (and contrib?) from github as well as the commands to keep updating

Re: Recommendations on prepping a library for 1.2 release?

2010-06-16 Thread David Nolen
On Wed, Jun 16, 2010 at 11:34 PM, Richard Lyman richard.ly...@gmail.comwrote: On Wed, Jun 16, 2010 at 8:36 PM, David Nolen dnolen.li...@gmail.com wrote: On Wed, Jun 16, 2010 at 10:17 PM, Richard Lyman richard.ly...@gmail.com wrote: Everything's on github - right? The simplest commands

Re: Recommendations on prepping a library for 1.2 release?

2010-06-16 Thread Rob Lachlan
Do I need any branches? What are the branches? I thought that when a branch was stable it would be merged back into master (if I'm using the right terms). The master branch for clojure is the main development branch for 1.2 (someone correct me if I'm wrong). It's the one I'm using, and I'm

Leiningen documentation review?

2010-06-16 Thread Phil Hagelberg
I'm pushing for a Leiningen 1.2.0 release really soon now, and part of that effort is sprucing up the documentation. I've revamped the readme and added a tutorial for folks just getting started. Of course, self-editing is never as good as having outside help, so I'd love it if I could get some

Re: Recommendations on prepping a library for 1.2 release?

2010-06-16 Thread Phil Hagelberg
On Wed, Jun 16, 2010 at 8:34 PM, Richard Lyman richard.ly...@gmail.com wrote: All of this is assuming, hopefully incorrectly, that there's no automated nightly JAR that's being produced and made available somewhere. The clojure master branch is being built continuously here,

Re: basic help with netbeans/enclojure installation

2010-06-16 Thread Drew Vogel
You can easily download old releases of NetBeans. From the netbeans.orgfront page click on Download FREE. On that page click on Archive in the upper right corner. Finally look for the version select box on the right side of the page. IANAL, but I believe the license of each project allows you to