Re: lancet can now build itself!

2009-01-27 Thread Luc Prefontaine
Oups, the repository I checked out weeks ago was on Source Forge, not on Google Code. I missed Rich's email Dec. 17th about moving stuff to Google Code. Just found it in my Clojure mail folder (around 6,500 messages). I was rushing to get the final fixes for the production release January 6th and

Re: macro help

2009-01-27 Thread Michael Wood
On Wed, Jan 28, 2009 at 12:10 AM, .Bill Smith wrote: > > I'm trying to write a helper macro for invoking a class's main. > Here's the macro: > > (defmacro main [class & args] > #^{:doc "Invoke class's main with specified arguments, which are > automatically stringified"} > (if (= (count args) 0

Re: lancet can now build itself!

2009-01-27 Thread Michael Wood
On Tue, Jan 27, 2009 at 11:53 PM, Luc Prefontaine wrote: > > No need for an official release, if shell_out.clj becomes available in SVN > (and any dependencies) > that's fine with me. I am confused. shell_out.clj *is* in SVN: http://code.google.com/p/clojure-contrib/source/browse/trunk/src/clo

Re: Pretty printing a function's symbol

2009-01-27 Thread Michael Wood
On Tue, Jan 27, 2009 at 5:38 PM, Chouser wrote: > > On Tue, Jan 27, 2009 at 9:20 AM, Daniel Jomphe wrote: >> >> Michael Wood wrote: >> >>> I've seen various code snippets where people use something# in >>> functions. Is there any point to this or gensym except in a macro? > > The suffix# isn't

Re: Growing trees

2009-01-27 Thread Christophe Grand
Timothy Pratley a écrit : > I want to grow a tree programmatically so have been trying zippers: > > (defn insert-parent [loc n] > (clojure.zip/replace loc (clojure.zip/make-node > loc n loc))) > (println (clojure.zip/root (insert-parent (clojure.zip/seq-zip (list > 1

Re: Clojure for Games/Simluation/Art (Optimization in Clojure)

2009-01-27 Thread Eric Lavigne
> > > The technique was first described by Craig Reynolds in the 1980s and has > since then made it's way into many contemporary games. The algorithm is > interesting in that it's fairly computationally intensive. Each boid's > motion is determined by calculating it's distance from every other bo

Growing trees

2009-01-27 Thread Timothy Pratley
I want to grow a tree programmatically so have been trying zippers: (defn insert-parent [loc n] (clojure.zip/replace loc (clojure.zip/make-node loc n loc))) (println (clojure.zip/root (insert-parent (clojure.zip/seq-zip (list 1)) 2))) (println (clojure.zip/root (clo

Clojure for Games/Simluation/Art (Optimization in Clojure)

2009-01-27 Thread David Nolen
Dear Clojurians, After my obsessed stint with object orientation, I went on to a new obsessed stint with basic functional programming with the hope of converting a nice Java boid simulation written in the popular Processing pedagological tool. I would like to find out if anyone has pointers on im

repeat and replicate

2009-01-27 Thread Shawn Hoover
Why do we have both repeat and replicate? I can sort of keep them straight, but as they only differ by arity I wonder if they can be combined... or if I'm missing a subtle reason for separate names. A user in IRC threw out the possibility of infinite vs. finite functions, but interleave and map see

Re: Simple Examples of Concurrency?

2009-01-27 Thread Stephen C. Gilardi
On Jan 27, 2009, at 3:57 PM, wubbie wrote: Why defn ends with -(dash)? (defn- mire-handle-client [in out] A good approach to finding out what a function does is to consult "doc": (doc defn-) --Steve smime.p7s Description: S/MIME cryptographic signature

Re: IntelliJ Plugin Pre-Alpha 0.03 Available

2009-01-27 Thread Keith Bennett
Where did you find build version 8.1, #9678? I'm looking at their web site, and all I see is version 8.01, build 9164. Also, when I tried following the instructions for the plugin, startup of Idea never gets past the splash screen. I have a message into JetBrains support about it. - Keith On

Re: dispatch macros that are new to me

2009-01-27 Thread Christian Vest Hansen
On Wed, Jan 28, 2009 at 12:31 AM, Cosmin Stejerean wrote: > On Tue, Jan 27, 2009 at 5:21 PM, Mark Volkmann > wrote: >> >> > Yes, but it's specifically meant to be used as the first line of a >> > file, to allow Clojure script to use unix "shebang" format. >> >> What should follow it? Something l

Re: Multi-CPU on Mac Not Exploited?

2009-01-27 Thread Christian Vest Hansen
On Tue, Jan 27, 2009 at 9:34 PM, hank williams wrote: > > hmm... I'm confused. From the numbers in your example it looks like > server has an advantage by a factor of about 2x. But in your text you > say that the client version has an advantage with complicated code. > What am I missing? Does one

Re: Agent watchers on Refs

2009-01-27 Thread MikeM
On Jan 27, 10:08 am, Tom Ayerst wrote: > I thought the validator just set "Agent has errors" and you have to check it > explicitly. Vars, refs and agents can have validators. A validator on a ref can prevent the ref from taking on a new value by throwing an exception, which will cause a roll-b

Re: Newbie: Trying to write revised multithreaded Swing Celsius converter app

2009-01-27 Thread Keith Bennett
samppi - Typical Swing programs create a window with all its components and event handlers in the main thread, and then launch the event handling thread implicitly by calling setVisible(true) on the window (usually a JFrame). I've always done it this way, and have never had a problem. However, t

Re: dispatch macros that are new to me

2009-01-27 Thread Cosmin Stejerean
On Tue, Jan 27, 2009 at 5:21 PM, Mark Volkmann wrote: > > > Yes, but it's specifically meant to be used as the first line of a > > file, to allow Clojure script to use unix "shebang" format. > > What should follow it? Something like this? > #!/Users/Mark/bin/clj > > That's the path to where my clj

Re: dispatch macros that are new to me

2009-01-27 Thread Mark Volkmann
On Tue, Jan 27, 2009 at 3:13 PM, Chouser wrote: > > On Tue, Jan 27, 2009 at 4:04 PM, Mark Volkmann > wrote: >> >> I ran across two dispatch macros today that I haven't seen before. >> >> What does #= do? I see in LispReader.java that it uses an EvalReader >> which is also defined in that source

Re: Newbie: Trying to write revised multithreaded Swing Celsius converter app

2009-01-27 Thread Timothy Pratley
> I read > somewhere that I should do those things only in the "event dispatch > thread", and that SwingUtilities.invokeLater(Runnable) would make that > work. But I'm not sure if I get it yet; why would I need to do that? The GUI runs in its own thread (the event thread). If you tried to update

Re: macro help

2009-01-27 Thread Christophe Grand
.Bill Smith a écrit : > To take the extra Java class out of the loop, I wrote this second > macro: > > user=> (defmacro s [& args] `(java.util.Arrays/asList (into-array (map > str '~args > #'user/s > user=> (let [c "value of c"] (s "1" c)) > # > user=> (macroexpand-1 '(s "1" c)) (java.util.

Re: Multi-CPU on Mac Not Exploited?

2009-01-27 Thread hank williams
hmm... I'm confused. From the numbers in your example it looks like server has an advantage by a factor of about 2x. But in your text you say that the client version has an advantage with complicated code. What am I missing? Does one JVM have the advantage in one situation and one in others? Hank

macro help

2009-01-27 Thread .Bill Smith
I'm trying to write a helper macro for invoking a class's main. Here's the macro: (defmacro main [class & args] #^{:doc "Invoke class's main with specified arguments, which are automatically stringified"} (if (= (count args) 0) `(. ~class main (make-array String 0)) `(. ~class main (i

Re: Simple Examples of Concurrency?

2009-01-27 Thread Timothy Pratley
> Can anyone point me to simple examples of how concurrency works in > Clojure?  (Not just one-liners, but examples that actually modify > values from multiple threads, and hopefully print out some helpful > information? Rich's ants example is really good: http://clojure.googlegroups.com/web/ants

Re: lancet can now build itself!

2009-01-27 Thread Luc Prefontaine
No need for an official release, if shell_out.clj becomes available in SVN (and any dependencies) that's fine with me. I can check the differences with the version I have checked out a few weeks ago and find the impacts. I only use sql from contrib intensively in production and I can test easily

Re: dispatch macros that are new to me

2009-01-27 Thread Chouser
On Tue, Jan 27, 2009 at 4:04 PM, Mark Volkmann wrote: > > I ran across two dispatch macros today that I haven't seen before. > > What does #= do? I see in LispReader.java that it uses an EvalReader > which is also defined in that source file, but it's not clear to me > what it does. It's used by

Re: lancet can now build itself!

2009-01-27 Thread Stuart Halloway
Hi Luc, Are you suggesting a new release of contrib to catch the changes to shell_out.clj, or something different? Sorry if I am being obtuse. :-) Stuart > Hi Stuart, > > it might be a good idea to release shell_out.clj in the SVN > repository of clojure-contrib. > > I have to deal with tw

Re: lancet can now build itself!

2009-01-27 Thread Luc Prefontaine
Hi Stuart, it might be a good idea to release shell_out.clj in the SVN repository of clojure-contrib. I have to deal with two versions of the jar file for clojure-contrib if I want to use lancet and preserve what I have deployed right now. My version of clojure is not too far behind yours. Given

Re: Simple Examples of Concurrency?

2009-01-27 Thread Meikel Brandmeyer
Hi, Am 27.01.2009 um 21:57 schrieb wubbie: Why defn ends with -(dash)? (defn- mire-handle-client [in out] defn- works exactly like defn, but creates a Var, which is only visible in the defining namespace. So when you :use the namespace this function will not be exported to the other namespac

dispatch macros that are new to me

2009-01-27 Thread Mark Volkmann
I ran across two dispatch macros today that I haven't seen before. What does #= do? I see in LispReader.java that it uses an EvalReader which is also defined in that source file, but it's not clear to me what it does. What does #! do? I see in LispReader.java that it uses a CommentReader. Is it

Re: Simple Examples of Concurrency?

2009-01-27 Thread wubbie
Hi Phil, Why defn ends with -(dash)? (defn- mire-handle-client [in out] On Jan 27, 1:16 pm, Phil Hagelberg wrote: > Keith Bennett writes: > > I'm trying to wrap my head around Clojure's concurrency.  I'm new to > > Lisp-like languages, and the examples that I've found are a bit > > complex.

Re: Multi-CPU on Mac Not Exploited?

2009-01-27 Thread dreish
java -server is not the default on Macs. It makes a huge difference for Clojure. % java -jar clojure.jar Clojure user=> (time (reduce #(+ %1 %2 (if (odd? %1) -1 0)) (range 1000))) "Elapsed time: 11793.18 msecs" 499001 % java -server -jar clojure.jar Clojure user=> (time (reduce #(+ %

Will Clojure work on AppEngine?

2009-01-27 Thread Robin
Under a huge assumption that Google will soon announce a 'Java compatible' runtime for AppEngine. Could Clojure work out of the box? Would Clojure's dynamic generation of ASM/bytecode pose a security problem for a generic sandboxed environment? If expected conflicts exist, what kind of adaptati

Re: Simple Examples of Concurrency?

2009-01-27 Thread Phil Hagelberg
Keith Bennett writes: > I'm trying to wrap my head around Clojure's concurrency. I'm new to > Lisp-like languages, and the examples that I've found are a bit > complex. > > Can anyone point me to simple examples of how concurrency works in > Clojure? (Not just one-liners, but examples that act

Re: 'ls.c'/csv fixed space style directory listing, figure out the formatting to issues

2009-01-27 Thread Tom Faulhaber
Indeed with Common Lisp format, it is a one liner: (cl-format true "~{~{~3A ~...@a ~...@a ~A~%~}~}" lines) produces: -rw 13290 1216183460872 LispExample_Flow.png -rw 3211 1217537516267 PDFReport.java (nicely aligned in a fixed-width font) CL format is available for Clojure at: http://g

Re: Parameterized query with clojure.contrib.sql

2009-01-27 Thread luskwater
I've put together two functions that handle this for me, and although I haven't looked at recent changes to clojure.contrib.sql (which sound interesting), perhaps there might be some interest in what I've got. The first function takes a database connection and a SELECT statement, returning a func

Re: Stream utilities in clojure.contrib

2009-01-27 Thread Konrad Hinsen
On Jan 27, 2009, at 16:28, cliffc wrote: > I think TCO is very doable and likely to appear in some common JVMs at > some point. > Continuations, on the other hand, are likely to require a massive > infrastructure overhaul. TCO would already by a step forward: it would make continuation- passing

Re: Newbie: Trying to write revised multithreaded Swing Celsius converter app

2009-01-27 Thread samppi
Thanks for the response. Yeah, I used SwingWorker just for education's sake. I'm just trying to figure out the best practices to do for Clojure/Swing in the future. The last question was about something I read on one of Sun's Swing tutorials--the text-sampler-gui function calls a bunch of Swing co

Re: Newbie: Trying to write revised multithreaded Swing Celsius converter app

2009-01-27 Thread Keith Bennett
samppi - I don't suggest using SwingWorker for this unless you just want to practice using it for education's sake. The calculation time is effectively zero in an application like this where actions are user- triggered, so using SwingWorker is a case of unnecessary and premature optimization...a

pretty-printing?

2009-01-27 Thread Mike DeLaurentis
Hi, Is anyone aware of a pretty-print function for Clojure? I saw there was some discussion about it on this thread a while ago, but I don't seem to see anything related to pretty-print in either the core or clojure-contrib. If no one's working on implementing it, I might take a stab at it. Than

Re: symbols, vars and namespaces

2009-01-27 Thread Chouser
On Tue, Jan 27, 2009 at 10:05 AM, Brian Doyle wrote: > > On Tue, Jan 27, 2009 at 7:43 AM, Chouser wrote: >> >> user=> (def expr (read (java.io.PushbackReader. (java.io.StringReader. >> "(+ 1 2)" >> user=> (first expr) >> + >> user=> (namespace (first expr)) >> nil > > This nil namespace seem

Re: Pretty printing a function's symbol

2009-01-27 Thread Chouser
On Tue, Jan 27, 2009 at 9:20 AM, Daniel Jomphe wrote: > > Michael Wood wrote: > >> I've seen various code snippets where people use something# in >> functions. Is there any point to this or gensym except in a macro? The suffix# isn't made useful by being in a macro, but by being in a syntax-quo

Patch: comp with 0 arguments, -> with 1

2009-01-27 Thread Robert Pfeiffer
Hello everybody, (comp) should evaluate the identity function, so comp behaves consistent with other variadic functions and returns a neutral value on the zero-argument-case. This is consistent with +, because (+ (+) x) = x and (comp (comp) fun) = fun. For similar rasons, (-> x) should evaluate t

Re: Stream utilities in clojure.contrib

2009-01-27 Thread cliffc
I think TCO is very doable and likely to appear in some common JVMs at some point. Continuations, on the other hand, are likely to require a massive infrastructure overhaul. Cliff On Jan 26, 4:38 am, Rich Hickey wrote: > On Jan 26, 3:20 am, Konrad Hinsen wrote: > > > On 25.01.2009, at 21:33,

Re: On a future Clojure Datalog

2009-01-27 Thread smanek
Please disregard this thread - I seem to have double posted accidentally. The second post is at: http://groups.google.com/group/clojure/browse_thread/thread/aa1532f2906ad8c1 On Jan 26, 11:56 pm, smanek wrote: > Hello all, > > I'm a Common Lisp programmer who has just started learning Clojure. I

Re: Agent watchers on Refs

2009-01-27 Thread Tom Ayerst
I thought the validator just set "Agent has errors" and you have to check it explicitly. Tom 2009/1/27 MikeM > > > > Were watchers synchronous, they would have to run post-transaction > > (else a watcher action failure could cause a transaction rollback, > > leaving already notified watchers co

Re: symbols, vars and namespaces

2009-01-27 Thread Brian Doyle
On Tue, Jan 27, 2009 at 7:43 AM, Chouser wrote: > > On Tue, Jan 27, 2009 at 8:51 AM, Mark Volkmann > wrote: > > > > Are these statements correct? Actually, I know some are correct > > because I just looked though the source. Hopefully others that haven't > > will find this interesting. > > > > S

Re: Thinking in Clojure - static fields?

2009-01-27 Thread Chouser
On Mon, Jan 26, 2009 at 11:13 PM, Whirlycott wrote: > > I'm new to Clojure and I'm wondering how I'm supposed to be thinking > about various things. I want to use the c3p0 database connection pool > in a Clojure app. In Java, I would simply create an instance of this > class and either assign i

Re: def vs. intern

2009-01-27 Thread Mark Volkmann
On Mon, Jan 26, 2009 at 8:19 PM, James Reeves wrote: > > On Jan 27, 2:08 am, Mark Volkmann wrote: >> Let's see if I've got this straight. >> >> (def foo 1) creates a Var in the default namespace with a value of 1. >> >> (create-ns 'com.ociweb.demo) ; creates a new namespace >> (intern 'com.ociwe

Re: symbols, vars and namespaces

2009-01-27 Thread Chouser
On Tue, Jan 27, 2009 at 8:51 AM, Mark Volkmann wrote: > > Are these statements correct? Actually, I know some are correct > because I just looked though the source. Hopefully others that haven't > will find this interesting. > > Symbol objects have a String name and a String namespace name, but n

Re: Pretty printing a function's symbol

2009-01-27 Thread Daniel Jomphe
Michael Wood wrote: > > (defn with-test-report [test fn] > > You are shadowing clojure.core/fn here. Not a problem really, but > perhaps it would be better to use a different name? Oh, and > clojure.core/test. Oh, right! Didn't think of it this way; it might be misleading to any future reader

Re: Multi-CPU on Mac Not Exploited?

2009-01-27 Thread Michael Reid
On Tue, Jan 27, 2009 at 3:04 AM, Keith Bennett wrote: > > All - > > I tried testing the code at http://clojure.org/Refs to see what the > benefit of multicore processing would be. To my surprise, the my-pmap > function took *more* time, not less, than the map function. > > Whereas the times list

Re: Thinking in Clojure - static fields?

2009-01-27 Thread Timothy Pratley
Here is one way: (let [dbc (make-db)] (defn get-apples [] (.query dbc "select * from apples"))) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@go

symbols, vars and namespaces

2009-01-27 Thread Mark Volkmann
Are these statements correct? Actually, I know some are correct because I just looked though the source. Hopefully others that haven't will find this interesting. Symbol objects have a String name and a String namespace name, but no value. Var objects have references to a Symbol object, a Namespa

Re: Agent watchers on Refs

2009-01-27 Thread MikeM
> Were watchers synchronous, they would have to run post-transaction > (else a watcher action failure could cause a transaction rollback, > leaving already notified watchers confused). Being post-transaction > would mean that the refs could have been changed by another > transaction in the interi

On a future Clojure Datalog

2009-01-27 Thread smanek
Hello all, I'm a Common Lisp programmer who has just started learning Clojure. I saw it mentioned online that several members of the existing community were looking for someone to build a datalog for Clojure: I was wondering what exactly you had in mind? Were you thinking of a faithful implement

Questions about a Clojure Datalog

2009-01-27 Thread smanek
Hello all, I'm a Common Lisp programmer who has just started learning Clojure. I saw it mentioned online that several members of the existing community were looking for someone to build a datalog for Clojure: I was wondering what exactly you had in mind? Were you thinking of a faithful implement

Thinking in Clojure - static fields?

2009-01-27 Thread Whirlycott
I'm new to Clojure and I'm wondering how I'm supposed to be thinking about various things. I want to use the c3p0 database connection pool in a Clojure app. In Java, I would simply create an instance of this class and either assign it to a static field or perhaps make it available in a singleton

Simple Examples of Concurrency?

2009-01-27 Thread Keith Bennett
All - I'm trying to wrap my head around Clojure's concurrency. I'm new to Lisp-like languages, and the examples that I've found are a bit complex. Can anyone point me to simple examples of how concurrency works in Clojure? (Not just one-liners, but examples that actually modify values from mul

Thinking in Clojure - static fields?

2009-01-27 Thread Whirlycott
I'm new to Clojure and I'm wondering how I'm supposed to be thinking about various things. I want to use the c3p0 database connection pool in a Clojure app. In Java, I would simply create an instance of this class and either assign it to a static field or perhaps make it available in a singleton

Multi-CPU on Mac Not Exploited?

2009-01-27 Thread Keith Bennett
All - I tried testing the code at http://clojure.org/Refs to see what the benefit of multicore processing would be. To my surprise, the my-pmap function took *more* time, not less, than the map function. Whereas the times listed in the article were approximately 3.1 and 1.7 seconds, on my MacBo

zipper: missing down-right

2009-01-27 Thread Christophe Grand
I keep needing to go to the last (rightmost) child of a loc (generally after appending it). (Or I failed to spot the proper idiom.) So I wrote last-child: (defn last-child [loc] (last (take-while identity (iterate zip/right (zip/down loc) but it feels a bit overkill because of all thi

Re: Dauphin: mona lisa genetic algorithm in clojure

2009-01-27 Thread Christian Vest Hansen
On Tue, Jan 27, 2009 at 8:43 AM, bOR_ wrote: > > According to one of the posts beneath the log, the issue has been > fixed in the latests svns. I have no clue what the technical problem > was in clojure's source. To my understanding, the technical problem was that Clojure used the same ClassLoad

Re: Ugly Sudoku solver

2009-01-27 Thread Konrad Hinsen
On Jan 27, 2009, at 7:48, Tzach wrote: > I do not understand the benefit of storing the map-board result. > The map-board function it self is using lazy for loop. > Why isn't the laziness transitive automatically? map-board is indeed lazy, but every time you call it it creates a *new* lazy seq

Re: odd error with filter

2009-01-27 Thread Christophe Grand
bOR_ a écrit : > (filter #(:born \...@%) world) > Did you mean: (filter #(:born @%) world) ? Christophe --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to cloju

Re: Pretty printing a function's symbol

2009-01-27 Thread Michael Wood
On Mon, Jan 26, 2009 at 10:03 PM, Daniel Jomphe wrote: > > Perry Trolard wrote: > >> You can get the symbol that names the function from the Var's >> metadata, like: >> >> user=> (:name (meta (var =))) >> = > > Thank you Perry. > > What is (var ...)? I didn't find it in the api docs, nor in the V