Waiting for agents

2010-12-17 Thread nicolas.o...@gmail.com
Dear all, Is there a way to wait for all agents to be up-to-date without using await ? I am in a specific case with a lot of agents and I want all of them to have finished their work, and only a few of them had initially work to do. It is quite wasteful to explicitly await for N agents when

Re: Waiting for agents

2010-12-17 Thread Laurent PETIT
2010/12/17 nicolas.o...@gmail.com nicolas.o...@gmail.com Dear all, Is there a way to wait for all agents to be up-to-date without using await ? I am in a specific case with a lot of agents and I want all of them to have finished their work, and only a few of them had initially work to

Re: Waiting for agents

2010-12-17 Thread nicolas.o...@gmail.com
I could, but I would have to add a watcher on every agent putting them into a seq hold by an atom. Which does not seem right, in some way... On Fri, Dec 17, 2010 at 12:01 PM, Laurent PETIT laurent.pe...@gmail.com wrote: 2010/12/17 nicolas.o...@gmail.com nicolas.o...@gmail.com Dear all, Is

Re: Waiting for agents

2010-12-17 Thread Laurent PETIT
2010/12/17 nicolas.o...@gmail.com nicolas.o...@gmail.com I could, but I would have to add a watcher on every agent putting them into a seq hold by an atom. Which does not seem right, in some way... Is the thread which creates the agent calls the thread which will wait for the agents being up

Re: Waiting for agents

2010-12-17 Thread nicolas.o...@gmail.com
I have a complex dependency graph between the used agents, so it is difficult to compute the p-agent I want. (They are actually launched by watchers on the agents itself.) After thought, agents may not be what I need. I may try to use Fork/Join instead... (What I do is a bit more structured on

Re: Waiting for agents

2010-12-17 Thread Konrad Hinsen
On 17 Dec, 2010, at 15:31 , nicolas.o...@gmail.com wrote: I have a complex dependency graph between the used agents, so it is difficult to compute the p-agent I want. (They are actually launched by watchers on the agents itself.) After thought, agents may not be what I need. I may try to

name protect anonymous macros ?

2010-12-17 Thread Trevor
n00b questions :) 1. How do I create a function and/or a macro that accepts an unbound name and interprets that name as a symbol? example: (defn perpetuate [name args] (do-stuff-with name args) (println name)) = (perpetuate world arg1 arg2) world this may seem silly or non-idiomatic,

Re: name protect anonymous macros ?

2010-12-17 Thread Ken Wesson
On Fri, Dec 17, 2010 at 10:54 AM, Trevor tcr1...@gmail.com wrote: n00b questions :) 1. How do I create a function and/or a macro that accepts an unbound name and interprets that name as a symbol? Function: (defn foo [x] (println x)) user=(foo 'quux) quux nil user= (defn bar [x]

Re: Possible to use from clojure.contrib.strint with a string variable

2010-12-17 Thread Michael
Ken/Alex, Thanks for taking the time to look at this and providing explanations/ ideas. Now I realize I can use forms instead of strings. I was looking for a way to specify a collection of strings and be able to expand them out under different bindings. (def v 0) (def coll ['(str v: v) '( v:

Error handling implementation - looking for criticisms and suggestions

2010-12-17 Thread jweiss
I'd been shopping around for an error handling kit for Clojure. What I needed was: * The ability to specify error handlers at the caller's level, that are accessible all the way up the stack from them. * Ability to include more data in an error than just a message and stack trace. That data

Re: name protect anonymous macros ?

2010-12-17 Thread Trevor
Thanks for responding, but I know all this. 1. I know how to pass string and symbols into functions and I know how to coerce. 2. I don't want to bind the name, I want to interpret the name as a symbol, thus - (defmacro baz [x y] `(def x y)), is not useful. 3. CL has anonymous macros, so why do

Re: Possible to use from clojure.contrib.strint with a string variable

2010-12-17 Thread Ken Wesson
On Fri, Dec 17, 2010 at 11:38 AM, Michael mw10...@gmail.com wrote: Ken/Alex, Thanks for taking the time to look at this and providing explanations/ ideas.  Now I realize I can use forms instead of strings.  I was looking for a way to specify a collection of strings and be able to expand

Re: name protect anonymous macros ?

2010-12-17 Thread Ken Wesson
On Fri, Dec 17, 2010 at 1:22 PM, Trevor tcr1...@gmail.com wrote: Thanks for responding, but I know all this. 1. I know how to pass string and symbols into functions and I know how to coerce. 2. I don't want to bind the name, I want to interpret the name as a symbol In what sense? Apparently

Re: name protect anonymous macros ?

2010-12-17 Thread Alan
On Dec 17, 8:31 am, Ken Wesson kwess...@gmail.com wrote: 2. Is there a form for anonymous macros? Nope. I'm not sure why you'd want one, either. This was my reaction too, but after some thought I can imagine scenarios where it would be useful. For example, say I want to defn several versions

Re: Waiting for agents

2010-12-17 Thread nicolas.o...@gmail.com
How about futures? They are in clojure.core and can be used for much the same purposes as Fork/Join, unless your individual tasks are so small that the performance advantage of Fork/Join makes a difference. Thank you for this suggestion. I thought a bit, and I wonder whether it can result

Re: name protect anonymous macros ?

2010-12-17 Thread Ken Wesson
On Fri, Dec 17, 2010 at 1:37 PM, Alan a...@malloys.org wrote: On Dec 17, 8:31 am, Ken Wesson kwess...@gmail.com wrote: 2. Is there a form for anonymous macros? Nope. I'm not sure why you'd want one, either. This was my reaction too, but after some thought I can imagine scenarios where it

Re: Waiting for agents

2010-12-17 Thread Zach Tellman
(future ...) enqueues tasks onto a thread pool. On Dec 17, 10:47 am, nicolas.o...@gmail.com nicolas.o...@gmail.com wrote: How about futures? They are in clojure.core and can be used for much the same purposes as Fork/Join, unless your individual tasks are so small that the performance

Re: Waiting for agents

2010-12-17 Thread Konrad Hinsen
On 17 Dec 2010, at 19:47, nicolas.o...@gmail.com wrote: How about futures? They are in clojure.core and can be used for much the same purposes as Fork/Join, unless your individual tasks are so small that the performance advantage of Fork/Join makes a difference. Thank you for this

Re: name protect anonymous macros ?

2010-12-17 Thread Armando Blancas
2. I don't want to bind the name, I want to interpret the name as a symbol user= (defmacro perpetuate [name] `(let [q# (quote ~name)] (println q#) q#)) #'user/perpetuate user= (class (perpetuate somename)) somename clojure.lang.Symbol -- You received this message because you are subscribed to

Re: name protect anonymous macros ?

2010-12-17 Thread Trevor
ahhh - thank you! On Dec 17, 1:23 pm, Armando Blancas armando_blan...@yahoo.com wrote: 2. I don't want to bind the name, I want to interpret the name as a symbol user= (defmacro perpetuate [name] `(let [q# (quote ~name)] (println q#) q#)) #'user/perpetuate user= (class (perpetuate

Re: name protect anonymous macros ?

2010-12-17 Thread Ken Wesson
On Fri, Dec 17, 2010 at 3:26 PM, Trevor tcr1...@gmail.com wrote: ahhh - thank you! On Dec 17, 1:23 pm, Armando Blancas armando_blan...@yahoo.com wrote: 2. I don't want to bind the name, I want to interpret the name as a symbol user= (defmacro perpetuate [name] `(let [q# (quote ~name)]

currying in clojure for fixed number of arg functions

2010-12-17 Thread Sunil S Nandihalli
Hello everybody, I remember that the key reasoning for not supporting currying in clojure was to be able to have variable number of arg functions.. So, I just thought a bit and realized that it should be possible to do that for fixed arity functions .. and then wrote the following macro to define

Re: name protect anonymous macros ?

2010-12-17 Thread Trevor
Lol.You're correct - it's so easy i don't know why I didn't see it. I'm somewhat new to macros. That said - I thought my question was clearly stated: How do I create a function and/or a macro that accepts an unbound name and interprets that name as a symbol? On Dec 17, 1:35 pm, Ken Wesson

Re: Java out of memory problem

2010-12-17 Thread clj123
(defn persist-rows [headers rows id] (let [mrows (transform-rows rows id)] (with-db *db* (try (apply insert-into-table :my-table [:col1 :col2 :col3] mrows))) nil )) (defn filter-data [rows item-id header id] (persist-rows

Re: Java out of memory problem

2010-12-17 Thread Ken Wesson
On Fri, Dec 17, 2010 at 5:39 PM, clj123 ariela2...@gmail.com wrote: (defn persist-rows  [headers rows id]  (let [mrows (transform-rows rows id)]    (with-db *db* (try         (apply insert-into-table                :my-table                [:col1 :col2 :col3]                mrows)))    

Logos v0.2: or Life w/o Tail Call Optimization

2010-12-17 Thread David Nolen
I just pushed out a new release of Logos, my implementation of miniKanren. At this point it's now pretty original, v0.1's goal and goal constructor code was mostly a port. Because of that it suffered as the original implementation assumed TCO. I rewrote that portion of the code from scratch to use

Re: currying in clojure for fixed number of arg functions

2010-12-17 Thread Sunil S Nandihalli
Hi Eric, I do know about partial. But what I am saying is that the extra function, partial, is not necessary if the function was created with def-curry-fn... The function automatically returns a curried version when called with fewer number of arguments than necessary like it happens in

Re: currying in clojure for fixed number of arg functions

2010-12-17 Thread Sunil S Nandihalli
On Sat, Dec 18, 2010 at 7:21 AM, Sunil S Nandihalli sunil.nandiha...@gmail.com wrote: Hi Eric, I do know about partial. But what I am saying is that the extra function, partial, is not necessary if the function was created with def-curry-fn... The function automatically returns a

Re: currying in clojure for fixed number of arg functions

2010-12-17 Thread Robert McIntyre
I think your work is a wonderful idea. I've been wanting to do this myself for some time. Thanks for actually doing it instead of just thinking about it. I have some humble thoughts/suggestions after reading your code; I'd love to hear what you think about these points: 1. I think that

about the repl

2010-12-17 Thread tor
Hi, I have a couple of questions. If I start listing an infinite sequence in the repl and the press ctrl-c, I always exit to bash. Is there a way to interrupt without exiting the repl? Is there a way to activate word completion in the repl? I find myself hitting tab all the time... I use the

Re: about the repl

2010-12-17 Thread Robert McIntyre
You can execute (set! *print-length* 20) to avoid traps with printing infinite data structures. I'd also highly recommend the emacs/swank combo for your repl. It's got tab completion and a lot more. try http://riddell.us/ClojureSwankLeiningenWithEmacsOnLinux.html to learn how to get started with

Re: about the repl

2010-12-17 Thread tor
Thanks for the quick reply! I tried to get used to emacs a few years ago with little success. But I'm going to give it another try. -- 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