Re: inconsistent behaviour when resolving java classes

2010-07-07 Thread Meikel Brandmeyer
Hi, On Jul 7, 3:37 am, Pedro Teixeira wrote: > user> (use 'clojure.test) > user> (testing (defrecord R []) (new R) ) > > [exception: Unable to resolve classname: R] I think you get caught by the toplevel form. Clojure compiles the complete testing form before executing it. So the (R.) can't see

Re: auto-indent in Counterclockwise

2010-07-07 Thread Laurent PETIT
Steven, I did not know this page, thanks for the link. But to make it really clear: move-past-close-and-reindent is exactly what counterclockwise's is doing in "Strict" edition mode (not totally true concerning the reindentation, currently in ccw it is only reorganizing closing brackets by removin

ANN: Aleph, an asynchronous web server

2010-07-07 Thread Zach Tellman
At the Bay Area user group meeting in June, there was a very interesting discussion about how to best use Clojure's concurrency primitives to field large numbers of concurrent requests, especially in a long-poll/push type application. We didn't arrive at any solid conclusion, but it was clear to e

Re: ANN: CDT - The Clojure Debugging Toolkit

2010-07-07 Thread George Jahad
Thanks Markus, yes, I intentionally wanted to keep it "decoupled from any particular editor". I had two goals in writing CDT. The immediate goal was to provide a better tool for debugging exceptions, which was harder than it should be in Clojure. The longer term goal was to expose the JDI to Cl

Re: ANN: CDT - The Clojure Debugging Toolkit

2010-07-07 Thread Nicolas Oury
It looks very cool. Great to have a Clojure text interface and not another adhoc laguage. Will make working with it easier, as well as building tools around it. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to cloju

Re: ANN: CDT - The Clojure Debugging Toolkit

2010-07-07 Thread Anders Rune Jensen
On Wed, Jul 7, 2010 at 11:43 AM, George Jahad wrote: > Thanks Markus, > > yes, I intentionally wanted to keep it "decoupled from any particular > editor".  I had two goals in writing CDT. > > The immediate goal was to provide a better tool for debugging > exceptions, which was harder than it shoul

Re: ANN: Aleph, an asynchronous web server

2010-07-07 Thread David Nolen
On Wed, Jul 7, 2010 at 5:15 AM, Zach Tellman wrote: > At the Bay Area user group meeting in June, there was a very > interesting discussion about how to best use Clojure's concurrency > primitives to field large numbers of concurrent requests, especially > in a long-poll/push type application. W

Re: ANN: CDT - The Clojure Debugging Toolkit

2010-07-07 Thread David Nolen
On Tue, Jul 6, 2010 at 2:14 AM, George Jahad wrote: > My experiment with the JDI: > > > http://georgejahad.com/clojure/cdt.html > > -- > 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 > No

Re: --> macro proposal

2010-07-07 Thread aria42
I've needed --> a few times in my code. I don't think I need it as much as just -> or ->>. Most of the time I've needed it is because I or someone else essentially had parameters in the wrong order. Maybe it belongs in contrib along with -?> which I've needed sparingly as well, but have found usefu

Re: --> macro proposal

2010-07-07 Thread Laurent PETIT
2010/7/7 aria42 : > I've needed --> a few times in my code. I don't think I need it as > much as just -> or ->>. Most of the time I've needed it is because I > or someone else essentially had parameters > in the wrong order. Maybe it belongs in contrib along with -?> which > I've needed sparingly a

Re: How to convert a list to arguments?

2010-07-07 Thread Cachou
Another way: suppose test-list -> (list 1 2 3) `(max ~...@test-list) can translate the form to what you want so you can use eval or define a macro to handle it. On Jul 5, 11:38 am, Mike Meyer wrote: > On Sun, 4 Jul 2010 20:21:22 -0700 (PDT) > > dennis wrote: > > For example: > > (max 1 2 3)

Re: inconsistent behaviour when resolving java classes

2010-07-07 Thread Nick Mudge
What about (use 'clojure.test.user) ? On Jul 6, 6:37 pm, Pedro Teixeira wrote: > Hi, > > The following seems like it was not intended, please let me know if it > is intended. > > user> (use 'clojure.test) > user> (testing (defrecord R []) (new R) ) > > [exception: Unable to resolve classname: R]

Re: ANN: Aleph, an asynchronous web server

2010-07-07 Thread ngocdaothanh
> [org.jboss.netty/netty "3.2.0.BETA1"] Netty 3.2.1.Final has been released. I think the ! mark in "respond!" is kind of misleading. Why not change it to "arespond"? -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email t

Re: Newbie questions about leiningen

2010-07-07 Thread songoku
> Thanks for both answers. Two ways of doing it. Great! The :jvm-opts "-Xmx1g" -option in the project-file doesnt seem to work with the swank-server. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googleg

Re: How to convert a list to arguments?

2010-07-07 Thread Nicolas Oury
On Wed, Jul 7, 2010 at 4:12 AM, Cachou wrote: > Another way: > > suppose test-list -> (list 1 2 3) > > `(max ~...@test-list) can translate the form to what you want > > so you can use eval or define a macro to handle it. > > > > But, most of the time, it is a bad idea. (Except if you are in situa

Re: ANN: Aleph, an asynchronous web server

2010-07-07 Thread Zach Tellman
On Jul 7, 2:57 am, ngocdaothanh wrote: > > [org.jboss.netty/netty "3.2.0.BETA1"] > > Netty 3.2.1.Final has been released. > > I think the ! mark in "respond!" is kind of misleading. Why not change > it to "arespond"? For some reason I couldn't get 3.2.1.Final to come in via maven. I didn't want

Make a loop in a loop

2010-07-07 Thread uap12
Hi! I try to make a printout witch vill have year 1999->2010 and every week Eg. Year=1999 Week=1 Year=1999 Week=2 Year=1999 Week=3 Year=1999 Week=4 Year=2000 Week=1 I have made the program in java, but like to try making it in Clojure, but so far i have got ---

Re: Counterclockwise version 0.0.59.RC2

2010-07-07 Thread miner
First, thanks for your work. I appreciate it. Now some comments: "Select top level s-expression" and "evaluate current selection or top- level s-expression" should act on the sexp in front of the cursor, especially if the cursor is at the end of an sexp. When I tried it, I was getting the next

Re: Make a loop in a loop

2010-07-07 Thread Nicolas Oury
(defn print-data2 [year] (dorun (map #(print-data year %) (range 1 53 1 I think you have both a problem with the syntax of anonymous functions and a problem of lazyness. map only creates a lazy seq that do not get evaluated. dorun do that You can have a look at list comprehensions (f

Re: inconsistent behaviour when resolving java classes

2010-07-07 Thread Pedro Henriques dos Santos Teixeira
On Wed, Jul 7, 2010 at 4:27 AM, Meikel Brandmeyer wrote: > Hi, > > On Jul 7, 3:37 am, Pedro Teixeira wrote: > >> user> (use 'clojure.test) >> user> (testing (defrecord R []) (new R) ) >> >> [exception: Unable to resolve classname: R] > > I think you get caught by the toplevel form. Clojure compil

Re: Make a loop in a loop

2010-07-07 Thread Greg
(for [y (range 1999 2011) w (range 1 52)] (println "year=" y "w=" w)) On Jul 7, 2010, at 10:47 AM, uap12 wrote: > Hi! > I try to make a printout witch vill have year 1999->2010 and every > week > Eg. > Year=1999 Week=1 > Year=1999 Week=2 > Year=1999 Week=3 > Year=1999 Week=4 > > Year=2000 We

Re: Make a loop in a loop

2010-07-07 Thread Lars Nilsson
On Wed, Jul 7, 2010 at 10:47 AM, uap12 wrote: > I have made the program in java, but like to try making it in Clojure, > but so far i have got > > (d

Re: Make a loop in a loop

2010-07-07 Thread Nurullah Akkaya
You can build a sequence of year week pairs using, (for [y (range 1999 2011) w (range 1 53)] [y w]) then you can iterate over that and print, (doseq [[y w] (for [y (range 1999 2011) w (range 1 53)] [y w])] (println "Year " y "Week " w)) Hope it helps... --

Re: Make a loop in a loop

2010-07-07 Thread Stuart Halloway
This usage of for is ill-advised: for is not a loop, it is a comprehension. This will not do what you want if, for example, you assign the result of for to a variable instead of entering it at the REPL. Nurullah's response on this thread shows a nice separation of building the (lazy) structure

Re: Counterclockwise version 0.0.59.RC2

2010-07-07 Thread Laurent PETIT
2010/7/7 miner : > First, thanks for your work.  I appreciate it.  Now some comments: > > "Select top level s-expression" and "evaluate current selection or top- > level s-expression" should act on the sexp in front of the cursor, > especially if the cursor is at the end of an sexp. By "in front",

Re: Make a loop in a loop

2010-07-07 Thread Laurent PETIT
or rather (for [y (range 1999 (inc 2010))       w (range 1 (inc 52))] [y w]) which remove the 2011 and 53 magic values ;-) 2010/7/7 Nurullah Akkaya : > You can build a sequence of year week pairs using, > > (for [y (range 1999 2011) >       w (range 1 53)] [y w]) > > then you can iterate over th

Re: Make a loop in a loop

2010-07-07 Thread Meikel Brandmeyer
Hi, Am 07.07.2010 um 17:10 schrieb Nurullah Akkaya: > (doseq [[y w] (for [y (range 1999 2011) > w (range 1 53)] [y w])] > (println "Year " y "Week " w)) And just for the record: If you don't need the intermediate seq you can use doseq directly: (doseq [y (range 199

Re: Counterclockwise version 0.0.59.RC2

2010-07-07 Thread miner
Many years of Emacs have trained me to expect evaluation of the form before the cursor. For example, with | standing for the cursor position: -- (+ 3 4)| (* 2 3) -- I expect to evaluate (+ 3 4). Often I put my cursor right after an expression just so I can execute it. Again, that's ho

Re: Counterclockwise version 0.0.59.RC2

2010-07-07 Thread Laurent PETIT
2010/7/7 miner : > [...] This also makes it convenient to type and expression and evaluate > it immediately without having to move the cursor. Now that's something to consider, indeed ... this makes sense ... -- You received this message because you are subscribed to the Google Groups "Clojure"

Re: ANN: Aleph, an asynchronous web server

2010-07-07 Thread David Nolen
On Wed, Jul 7, 2010 at 5:15 AM, Zach Tellman wrote: > With this in mind, I decided to make the thinnest possible wrapper > around Netty such that a person could play around with alternate ways > to use Clojure effectively. The result can be found at > http://github.com/ztellman/aleph. I played

Idiomatic Clojure namespace names

2010-07-07 Thread James Reeves
I've kinda asked this question before, but I framed in the context of a suggestion, and the discussion got bogged down with no real answer. So this time, let me keep it simple: if I have a small Clojure library, "foo", which only has one namespace, what is the idiomatic name for that namespace?

Re: Make a loop in a loop

2010-07-07 Thread Greg
On Jul 7, 2010, at 11:14 AM, Stuart Halloway wrote: > This usage of for is ill-advised: for is not a loop, it is a comprehension. > This will not do what you want if, for example, you assign the result of for > to a variable instead of entering it at the REPL. > > Nurullah's response on this th

Re: Make a loop in a loop

2010-07-07 Thread Greg
Oh, sorry, I misread, I thought you said "*The* usage of for is ill-advised" :-p - Greg On Jul 7, 2010, at 11:27 AM, Greg wrote: > On Jul 7, 2010, at 11:14 AM, Stuart Halloway wrote: > >> This usage of for is ill-advised: for is not a loop, it is a comprehension. >> This will not do what you w

Re: Make a loop in a loop

2010-07-07 Thread RandyHudson
'doseq instead 'for works fine: (doseq [y (range 1999 2011), w (range 1 52)] (print-data y w)) On Jul 7, 11:14 am, Stuart Halloway wrote: > This usage of for is ill-advised: for is not a loop, it is a comprehension. > This will not do what you want if, for example, you assign the result of for

Re: Make a loop in a loop

2010-07-07 Thread Greg
> If you don't need the intermediate seq you can use doseq directly: > > (doseq [y (range 1999 2011) >w (range 1 53)] > (println "Year" y "Week" w)) That's really cool, I didn't know you can do that. I just looked over its implementation and it seems pretty complex but interesting, so

Re: Idiomatic Clojure namespace names

2010-07-07 Thread Laurent PETIT
Hi, 2010/7/7 James Reeves : > I've kinda asked this question before, but I framed in the context of > a suggestion, and the discussion got bogged down with no real answer. > > So this time, let me keep it simple: if I have a small Clojure > library, "foo", which only has one namespace, what is the

Re: ANN: Aleph, an asynchronous web server

2010-07-07 Thread ngocdaothanh
> For some reason I couldn't get 3.2.1.Final to come in via maven. I think you need to add this to project.clj: :repositories [["jboss" "http://repository.jboss.org/nexus/content/ groups/public/"]] > What qualities is it missing that make the bang misleading? I thinks ! means something dangerous

Re: Idiomatic Clojure namespace names

2010-07-07 Thread Peter Schuller
This is not in answer to the question, but I just wanted to say: I love that fact that Clojure got namespaces "right" in the sense of allowing aliasing on import. Some languages don't do this, and you end up with very difficult naming issues since you suddenly have a huge desire to keep it short *w

Variadic arguments and macros

2010-07-07 Thread Cameron
Hello all! Today, I've either discovered a bug, or I've discovered a flaw in my understanding of macros. Most likely the latter :-) Could anyone set me straight? While this is not the macro I was trying to write, it falls over in the same place. (user=> (defmacro foo [& xs] `(map identity ~xs)) #

Re: Variadic arguments and macros

2010-07-07 Thread David Nolen
On Wed, Jul 7, 2010 at 12:49 PM, Cameron wrote: > Hello all! Today, I've either discovered a bug, or I've discovered a > flaw in my understanding of macros. Most likely the latter :-) Could > anyone set me straight? > > While this is not the macro I was trying to write, it falls over in > the sam

Re: Variadic arguments and macros

2010-07-07 Thread Nicolas Oury
If you macroexpand the first foo in (foo 1 2), you will see something like (1 2) when this gets evaluated, Clojure is not happy about 1 not being a function. On Wed, Jul 7, 2010 at 5:49 PM, Cameron wrote: > Hello all! Today, I've either discovered a bug, or I've discovered a > flaw in my unders

Re: Variadic arguments and macros

2010-07-07 Thread miner
I think you're missing a quote in your original macro. You wrote: (defmacro foo [& xs] `(map identity ~xs)) Try this in a REPL: user=> (macroexpand-1 '(foo 1 2)) (clojure.core/map clojure.core/identity (1 2)) That shows you that it's going to try to evaluate the form (1 2). The original complai

Re: Variadic arguments and macros

2010-07-07 Thread Nicolas Oury
Of course I meant (map identity (1 2)) On Wed, Jul 7, 2010 at 6:03 PM, Nicolas Oury wrote: > If you macroexpand the first foo in (foo 1 2), you will see something like > (1 2) > > when this gets evaluated, Clojure is not happy about 1 not being a > function. > > > On Wed, Jul 7, 2010 at 5:49 PM,

Re: Variadic arguments and macros

2010-07-07 Thread Jason Wolfe
Hi Cameron, On Jul 7, 9:49 am, Cameron wrote: > Hello all! Today, I've either discovered a bug, or I've discovered a > flaw in my understanding of macros. Most likely the latter :-) Could > anyone set me straight? > > While this is not the macro I was trying to write, it falls over in > the same

Re: Make a loop in a loop

2010-07-07 Thread Meikel Brandmeyer
Hi, Am 07.07.2010 um 18:04 schrieb Greg: >> If you don't need the intermediate seq you can use doseq directly: >> >> (doseq [y (range 1999 2011) >> w (range 1 53)] >> (println "Year" y "Week" w)) > > That's really cool, I didn't know you can do that. for and doseq are quite similar in it

Re: Variadic arguments and macros

2010-07-07 Thread Cameron
Thanks for all the replies everyone, I certainly have a solution now. But I am still a little confused. Take this slight variation... user=> (defmacro foo [coll] `(map identity ~coll)) #'user/foo user=> (foo [1 2 3 `(+ 1 1)]) (1 2 3 (clojure.core/+ 1 1)) In this one, I am passing an explicit list

Re: Variadic arguments and macros

2010-07-07 Thread Cameron
Thanks everyone! I certainly have my solution; but, I'm still a bit confused. Here's another example... user=> (defmacro foo [coll] `(map identity ~coll)) #'user/foo user=> (foo (list 1 2 3)) (1 2 3) In this example, I pass an explicit list and all I have to do is unquote 'coll'. How is passing a

Re: inconsistent behaviour when resolving java classes

2010-07-07 Thread Meikel Brandmeyer
Hi, Am 07.07.2010 um 15:47 schrieb Pedro Henriques dos Santos Teixeira: > Are there any design guidelines for choosing between defrecords and > defstruct, when one wants a map with type? > > I started with defrecord, but feels like I should switch to defstruct > to avoid these complex host integ

Re: ANN: Aleph, an asynchronous web server

2010-07-07 Thread Zach Tellman
On Jul 7, 9:12 am, David Nolen wrote: > On Wed, Jul 7, 2010 at 5:15 AM, Zach Tellman wrote: > > With this in mind, I decided to make the thinnest possible wrapper > > around Netty such that a person could play around with alternate ways > > to use Clojure effectively.  The result can be found at

Re: ANN: Aleph, an asynchronous web server

2010-07-07 Thread Zach Tellman
On Jul 7, 8:28 am, ngocdaothanh wrote: > > For some reason I couldn't get 3.2.1.Final to come in via maven. > > I think you need to add this to project.clj: > :repositories [["jboss" "http://repository.jboss.org/nexus/content/ > groups/public/"]] > Thanks, I'll give that a try. > > What qualitie

Re: Idiomatic Clojure namespace names

2010-07-07 Thread James Reeves
On 7 July 2010 17:24, Laurent PETIT wrote: > Of course, if your library has an especially cryptic name (as we have > with counterclockwise: ccw), then having also directly foo may also > not interfere with other's namespaces. That's the path we took for > counterclockwise, and our top-level namesp

Re: ANN: Aleph, an asynchronous web server

2010-07-07 Thread David Nolen
On Wed, Jul 7, 2010 at 1:43 PM, Zach Tellman wrote: > Developers are still required to "participate" in the NIO design, in > that blocking calls in the request handler need to be avoided to reap > the full benefits. Netty provides a lot of nice abstractions over > NIO, but kind of punts on how t

Re: ANN: Aleph, an asynchronous web server

2010-07-07 Thread James Reeves
On 7 July 2010 19:04, David Nolen wrote: > So something like this: > (defn hello-world [request] >   (future >    (Thread/sleep 1) >    (respond! request >              {:status 200 >               :headers {"Content-Type" "text/html"} >               :body "Hello world!"}))) > Is non-blocking and

Re: ANN: Aleph, an asynchronous web server

2010-07-07 Thread David Nolen
On Wed, Jul 7, 2010 at 2:10 PM, James Reeves wrote: > On 7 July 2010 19:04, David Nolen wrote: > > So something like this: > > (defn hello-world [request] > > (future > >(Thread/sleep 1) > >(respond! request > > {:status 200 > > :headers {"Content-Type" "text/

Re: Idiomatic Clojure namespace names

2010-07-07 Thread Meikel Brandmeyer
Hi, Am 07.07.2010 um 18:13 schrieb James Reeves: > - foo.core > - com.github.weavejester.foo I would go with one of these two. At the moment I prefer the former. I think putting domain names in the package is suboptimal for a quite simple reason. I'm a hobbyist. I don't own a domain. Eh? What

Re: ANN: Aleph, an asynchronous web server

2010-07-07 Thread Zach Tellman
On Jul 7, 11:17 am, David Nolen wrote: > On Wed, Jul 7, 2010 at 2:10 PM, James Reeves wrote: > > > > > > > On 7 July 2010 19:04, David Nolen wrote: > > > So something like this: > > > (defn hello-world [request] > > >   (future > > >    (Thread/sleep 1) > > >    (respond! request > > >        

Re: Link to API document in the cheat sheet

2010-07-07 Thread Justin Kramer
As part of the Clojure Examples Wiki experiment, I created a page adapted from the Cheatsheet, with links to relevant docs and examples (not many, yet): http://clojure-examples.appspot.com/clojure.core It's been reorganized and revised a bit from the Cheatsheet. The design is a little plain but i

navigate and edit tree nodes / branches

2010-07-07 Thread Bill Marshall
Is there a library facilitating the navigating and editing nodes in a fairly complex tree (nested map) structure? billm -- 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

Re: navigate and edit tree nodes / branches

2010-07-07 Thread Laurent PETIT
Quick answer (sorry not much time): clojure.zip It's quite easy to use once you've got the basics "in place" 2010/7/7 Bill Marshall : > Is there a library facilitating the navigating and editing nodes in a fairly > complex tree (nested map) structure?  billm > > -- > You received this message bec

Re: inconsistent behaviour when resolving java classes

2010-07-07 Thread Pedro Henriques dos Santos Teixeira
On Wed, Jul 7, 2010 at 2:42 PM, Meikel Brandmeyer wrote: > Hi,> > Am 07.07.2010 um 15:47 schrieb Pedro Henriques dos Santos Teixeira:> >> Are there any design guidelines for choosing between defrecords and >> defstruct, when one wants a map with type? >> >> I started with defrecord, but feels lik

Re: Idiomatic Clojure namespace names

2010-07-07 Thread Pedro Henriques dos Santos Teixeira
On Wed, Jul 7, 2010 at 2:55 PM, James Reeves wrote: > On 7 July 2010 17:24, Laurent PETIT wrote: >> Of course, if your library has an especially cryptic name (as we have >> with counterclockwise: ccw), then having also directly foo may also >> not interfere with other's namespaces. That's the pat

Re: ANN: Aleph, an asynchronous web server

2010-07-07 Thread Pedro Henriques dos Santos Teixeira
On Wed, Jul 7, 2010 at 3:10 PM, James Reeves wrote: > On 7 July 2010 19:04, David Nolen wrote: >> So something like this: >> (defn hello-world [request] >>   (future >>    (Thread/sleep 1) >>    (respond! request >>              {:status 200 >>               :headers {"Content-Type" "text/html"}

Re: Idiomatic Clojure namespace names

2010-07-07 Thread Saul Hazledine
On Jul 7, 5:24 pm, Laurent PETIT wrote: > if you intend to share the library, then use the classical prefix notation: > >   * either of the form net.reeves.james.foo  ( or any reversed tld you "own" ) >   * either of the form com.yourcorp.foo > com.read.to.easy.that.not.its.but -- You received

Clojure for NSF grant funding

2010-07-07 Thread David Blubaugh
To All, I am extremely interested in LISP and Clojure. I was wondering if it would be possible to obtain NSF grant funding for further development of Clojure ?? thanks, David Blubaugh -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to th

examples (like doc)

2010-07-07 Thread John Cromartie
I've whipped up a proof-of-concept of how to implement built-in examples for functions and macros. The general idea is to add an attribute to the var that contains a list of docstrings and arg lists or code that illustrate common usage. Let me know what you think: http://gist.github.com/466743 It

Re: Idiomatic Clojure namespace names

2010-07-07 Thread Mike Meyer
"Meikel Brandmeyer" wrote: >Hi, > >Am 07.07.2010 um 18:13 schrieb James Reeves: > >> - foo.core >> - com.github.weavejester.foo > >I would go with one of these two. At the moment I prefer the former. I think >putting domain names in the package is suboptimal for a quite simple reason. >I'm a h

Re: Variadic arguments and macros

2010-07-07 Thread Laurent PETIT
2010/7/7 Cameron : > Thanks everyone! I certainly have my solution; but, I'm still a bit > confused. Here's another example... > > user=> (defmacro foo [coll] `(map identity ~coll)) > #'user/foo > user=> (foo (list 1 2 3)) > (1 2 3) > > In this example, I pass an explicit list and all I have to do

Re: Clojure for NSF grant funding

2010-07-07 Thread Luc Préfontaine
Here in Canada we have a number of programs for R&D and the bureaucratic burden is not worth the $$$ you get back for it except if you a budget in the 6 digits range. And if you want to get the paper done by a consultant, he/she will charge 20% of the expected refund. I looked at the NSF documen

Re: examples (like doc)

2010-07-07 Thread Moritz Ulrich
I don't think examples should be integrated in the function-definition. It's *way* to much bloat. I like the way http://clojure-examples.appspot.com/clojure.core goes. A wiki-like documentation for examples, linked to every clojure-namespace. These examples could be serialized into some data struc

Ordering of messages to agents

2010-07-07 Thread Brian Hurt
I'm wondering if the following pattern is safe or not. I'm in a transaction, and I want to create an agent and then send it an initializing message (the message function isn't transaction-safe, so I don't want to run it in the transaction). So I want to do something like: (def my-ref (ref nil))

Re: Ordering of messages to agents

2010-07-07 Thread Meikel Brandmeyer
Hi, Am 07.07.2010 um 22:46 schrieb Brian Hurt: > I'm wondering if the following pattern is safe or not. I'm in a transaction, > and I want to create an agent and then send it an initializing message (the > message function isn't transaction-safe, so I don't want to run it in the > transaction

Re: Make a loop in a loop

2010-07-07 Thread Isak Hansen
On Wed, Jul 7, 2010 at 5:00 PM, Lars Nilsson wrote: > > Maybe > > (doseq [year (range 1999 2010 1)] >  (doseq [month (range 1 53 1)] >    (print-data year range))) > You could also do this with dotimes instead of doseq. Doesn't matter for Ns this small, but creating a range just so you have somet

Re: navigate and edit tree nodes / branches

2010-07-07 Thread Moritz Ulrich
There is also assoc-in and get-in for accessing and associng values in nested maps. On Wed, Jul 7, 2010 at 9:26 PM, Laurent PETIT wrote: > Quick answer (sorry not much time): clojure.zip > > It's quite easy to use once you've got the basics "in place" > > 2010/7/7 Bill Marshall : >> Is there a li

Re: Idiomatic Clojure namespace names

2010-07-07 Thread Meikel Brandmeyer
Hi, Am 07.07.2010 um 21:41 schrieb Mike Meyer: > Why bother renaming it when you move? Why come into a situation where bothering is a question? Sincerely Meikel PS: You K-9 Mail sends every message twice. -- You received this message because you are subscribed to the Google Groups "Clojure"

Re: Ordering of messages to agents

2010-07-07 Thread Brian Hurt
On Wed, Jul 7, 2010 at 5:04 PM, Meikel Brandmeyer wrote: > Hi, > > Am 07.07.2010 um 22:46 schrieb Brian Hurt: > > > I'm wondering if the following pattern is safe or not. I'm in a > transaction, and I want to create an agent and then send it an initializing > message (the message function isn't

Re: Re: Clojure for NSF grant funding

2010-07-07 Thread labwork07
All I know is that you have to show educational value for NSF. So, funding for development should be accompanied by teaching or lecturing. On Jul 7, 2010 4:14pm, Luc Préfontaine wrote: Here in Canada we have a number of programs for R&D and the bureaucratic burden is not worth the $

Re: Ordering of messages to agents

2010-07-07 Thread Ryan Waters
On Wed, Jul 7, 2010 at 3:46 PM, Brian Hurt wrote: > I'm wondering if the following pattern is safe or not.  I'm in a > transaction, and I want to create an agent and then send it an initializing > message (the message function isn't transaction-safe, so I don't want to run > it in the transaction)

Re: Ordering of messages to agents

2010-07-07 Thread Meikel Brandmeyer
Hi, Am 07.07.2010 um 23:11 schrieb Ryan Waters: >> (send a init-function) >> (send a f)) > > It's not guaranteed the init-function will complete before f. I doubt that. Since only one action can be active at a time and the ordering is preserved, init-function wi

Re: Make a loop in a loop

2010-07-07 Thread Dave M
On Jul 7, 5:06 pm, Isak Hansen wrote: > On Wed, Jul 7, 2010 at 5:00 PM, Lars Nilsson wrote: > > > Maybe > > > (doseq [year (range 1999 2010 1)] > >  (doseq [month (range 1 53 1)] > >    (print-data year range))) > > You could also do this with dotimes instead of doseq. Doesn't matter > for Ns thi

Re: Idiomatic Clojure namespace names

2010-07-07 Thread Mike Meyer
"Meikel Brandmeyer" wrote: >Hi, > >Am 07.07.2010 um 21:41 schrieb Mike Meyer: > >> Why bother renaming it when you move? > >Why come into a situation where bothering is a question? You would have to ask the people at sun.com who created the convention that one. >PS: You K-9 Mail sends every me

Re: auto-indent in Counterclockwise

2010-07-07 Thread Steven E. Harris
Laurent PETIT writes: > But to make it really clear: move-past-close-and-reindent is exactly > what counterclockwise's is doing in "Strict" edition mode (not totally > true concerning the reindentation, currently in ccw it is only > reorganizing closing brackets by removing extra spaces, not > re

Re: Clojure for NSF grant funding

2010-07-07 Thread Marc Spitzer
DARPA might be a better bet, they fund potentially useful things I have nothing to do with them though. Marc On 7/7/10, David Blubaugh wrote: > To All, > > > I am extremely interested in LISP and Clojure. I was wondering if it > would be possible to obtain NSF grant funding for further develo

Re: ANN: Aleph, an asynchronous web server

2010-07-07 Thread David Nolen
On Wed, Jul 7, 2010 at 2:10 PM, James Reeves wrote: > The main advantage of a non-blocking server is that you're don't use > up a thread waiting for an event (such as the user sending data, or > some other external trigger). > > - James I think the main advantage of a non-blocking server is thro

Re: Variadic arguments and macros

2010-07-07 Thread Pedro Teixeira
What's the idiomatic way to handle cases where one has a macro rather than a function? For example: intent is as follows but does not work: (def args [false true false]) (apply or args) alternatives? a> (eval `(or @~args)) b> (reduce #(or %1 %2) args) any recommended? thanks, Pedro On J

Re: Idiomatic Clojure namespace names

2010-07-07 Thread j-g-faustus
On Jul 7, 7:55 pm, James Reeves wrote: > For the purposes of this discussion, let us assume that "foo" is a > suitably unique library name, and it is highly unlikely there exist > any other libraries with the same name. It sounds like Clojure doesn't have an idiom for namespace names yet, so I gu

Re: ANN: Aleph, an asynchronous web server

2010-07-07 Thread Greg
"well I think the main advantage" is memory. :-) Theoretically (I think), thread-per-connection servers can be very close to matching asynchronous servers in throughput, but they definitely require much more RAM to do so. RAM is one of the more expensive commodities to come by on VPS and cloud

Re: Ordering of messages to agents

2010-07-07 Thread Ryan Waters
On Wed, Jul 7, 2010 at 4:32 PM, Meikel Brandmeyer wrote: > Hi, > > Am 07.07.2010 um 23:11 schrieb Ryan Waters: > >>>                 (send a init-function) >>>                 (send a f)) >> >> It's not guaranteed the init-function will complete before f. > > I doubt that. Since only one action ca

Re: Idiomatic Clojure namespace names

2010-07-07 Thread Mike Meyer
On Wed, 7 Jul 2010 18:53:39 -0700 (PDT) j-g-faustus wrote: > On Jul 7, 7:55 pm, James Reeves wrote: > > For the purposes of this discussion, let us assume that "foo" is a > > suitably unique library name, and it is highly unlikely there exist > > any other libraries with the same name. > > It s

defrecord + defprotocol brittleness (also about docstring handling)

2010-07-07 Thread Michał Marczyk
Just noticed that defprotocol -- or rather, emit-protocol -- simply assumes that method signatures are well-formed. This leads to the following behaviour: ;; this compiles fine (defprotocol PTestProt (p-test-method "foo" [this])) ;; this does not -- no matching method found (defrecord RTestRec

Re: navigate and edit tree nodes / branches

2010-07-07 Thread Michał Marczyk
(inc clojure.zip); clojure.contrib.zip-filter is a nice companion. Also, clojure.walk might be worth investigating. It provides no complex navigational facilities, so only some types of tree transformations are "walkable", but for dealing with those, it's an absolutely fantastic tool. Sincerely,

Re: Idiomatic Clojure namespace names

2010-07-07 Thread Michael Gardner
On Jul 7, 2010, at 8:53 PM, j-g-faustus wrote: > The disadvantage is of course that you end up with names like > org.apache.http.client.params.ClientPNames/ > CONNECTION_MANAGER_FACTORY_CLASS_NAME > which gets old really quick if you have to type it a lot :) Why would you ever type that more than

Re: Idiomatic Clojure namespace names

2010-07-07 Thread Daniel Gagnon
> > > Why would you ever type that more than once? Just use :as. > > Because you use it in more than one file / project. -- 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

Re: examples (like doc)

2010-07-07 Thread Heinz N. Gies
On Jul 7, 2010, at 21:05 , John Cromartie wrote: > I've whipped up a proof-of-concept of how to implement built-in > examples for functions and macros. The general idea is to add an > attribute to the var that contains a list of docstrings and arg lists > or code that illustrate common usage. >

Re: auto-indent in Counterclockwise

2010-07-07 Thread Laurent PETIT
2010/7/8 Steven E. Harris > Laurent PETIT writes: > > > But to make it really clear: move-past-close-and-reindent is exactly > > what counterclockwise's is doing in "Strict" edition mode (not totally > > true concerning the reindentation, currently in ccw it is only > > reorganizing closing brac

Re: Variadic arguments and macros

2010-07-07 Thread Laurent PETIT
2010/7/8 Pedro Teixeira > > What's the idiomatic way to handle cases where one has a macro rather > than a function? > > For example: > > intent is as follows but does not work: > (def args [false true false]) > (apply or args) > > > alternatives? > > a> (eval `(or @~args)) > big no-no. > > b>

Re: auto-indent in Counterclockwise

2010-07-07 Thread Lee Spector
I spent a bunch of time today in CCW 0.0.59.RC2, in "default" mode, and thought I'd report my experience: - Lots of very nice features and I really appreciate having this -- please don't take my criticisms below in the wrong way! - There are some cases in which the indentation doesn't follow t