Re: concurrency example about java x clojure

2010-09-20 Thread Phil Hagelberg
On Mon, Sep 20, 2010 at 7:15 PM, David Cabana wrote: >> > > The fact that currently having vals and keys return seqs in the same >> > order is not guaranteed by the documentation ? > > At the recent Pragmatic Studio class I asked Rich and Stuart about > this very point. As I recall, Rich said vals

Re: what's up with user.clj?

2010-09-20 Thread Phil Hagelberg
On Mon, Sep 20, 2010 at 10:07 PM, Kevin Downey wrote: > On Mon, Sep 20, 2010 at 7:33 PM, Robert McIntyre wrote: >> If it is to be deprecated, is there a "correct" way of achieving the >> same result (having things automatically loaded when you create the >> repl?) > > user.clj is very useful, I'd

Re: what's up with user.clj?

2010-09-20 Thread Kevin Downey
user.clj is very useful, I'd rather keep it. On Mon, Sep 20, 2010 at 7:33 PM, Robert McIntyre wrote: > If it is to be deprecated, is there a "correct" way of achieving the > same result (having things automatically loaded when you create the > repl?) > > --Robert McIntyre > > On Mon, Sep 20, 2010

Re: why the big difference in speed?

2010-09-20 Thread Jason Wolfe
On Sep 20, 4:43 pm, Ranjit wrote: > I'm glad you think partition is the problem, because that was my guess > too. But I think I have the answer. This is the fastest version I've > seen so far: > > (defn gaussian-matrix-final [L] >   (into-array ^doubles (map double-array (repeat L (repeatedly L ne

Clojure Serial Connection

2010-09-20 Thread Ivan Willig
I list, i am trying to connect to a USB GSM Modem with clojure. Basically, i want to open a serial connection to my modem and be able to pass commands to it. ( I think I am new to this whole modem thing). I know I can do this in Java, but wanted to check if someone had a working solutions in Cloju

Re: Clojure meetup group listing

2010-09-20 Thread Nick Brown
We've got one in the Raleigh area that, while not specific to Clojure, it is a common topic (along with other JVM based languages such as Scala and Groovy): http://www.meetup.com/TriJVM/ Though a Clojure specific meetup would be nice, I know for a fact there are other Clojure users here. On Sep 20

Re: Clojure meetup group listing

2010-09-20 Thread Miki
The L.A. one is at http://www.meetup.com/Los-Angeles-Clojure-Users-Group/ On Sep 20, 8:33 am, Andrew Gwozdziewycz wrote: > Hey All, > > I know there are certainly a few groups out there (organized via > Meetup.com or otherwise) which I see things posted about from time to > time on the list. I'd

Re: what's up with user.clj?

2010-09-20 Thread Robert McIntyre
If it is to be deprecated, is there a "correct" way of achieving the same result (having things automatically loaded when you create the repl?) --Robert McIntyre On Mon, Sep 20, 2010 at 11:59 AM, Laurent PETIT wrote: > BTW, shouldn't this "user.clj" trick be marked as deprecated, to be removed >

Re: concurrency example about java x clojure

2010-09-20 Thread David Cabana
> > > The fact that currently having vals and keys return seqs in the same > > order is not guaranteed by the documentation ? At the recent Pragmatic Studio class I asked Rich and Stuart about this very point. As I recall, Rich said vals and keys do behave as one would hope, so that for a map m we

Re: why the big difference in speed?

2010-09-20 Thread Ranjit
Actually it turns out the type hinting in gaussian-matrix-final isn't even necessary. I just took it out and the speed doesn't seem to change. On Sep 20, 7:43 pm, Ranjit wrote: > I'm glad you think partition is the problem, because that was my guess > too. But I think I have the answer. This is t

Re: why the big difference in speed?

2010-09-20 Thread Ranjit
I'm glad you think partition is the problem, because that was my guess too. But I think I have the answer. This is the fastest version I've seen so far: (defn gaussian-matrix-final [L] (into-array ^doubles (map double-array (repeat L (repeatedly L next- gaussian) If I understand what's goin

Re: [ANN] Leiningen 1.3.1

2010-09-20 Thread Andrew Gwozdziewycz
On Mon, Sep 20, 2010 at 3:08 PM, Eric Schulte wrote: > Hi, > > Having recently upgraded to this newest lein > > $ lein --version > Leiningen 1.3.1 on Java 1.6.0_18 OpenJDK Client VM > > I notice that the "lein swank" command is no longer supported. > > $ lein swank > That's not a task. Use "le

Re: concurrency example about java x clojure

2010-09-20 Thread Laurent PETIT
2010/9/21 Meikel Brandmeyer > Hello Laurent. > > Am 20.09.2010 um 22:38 schrieb Laurent PETIT: > > > The fact that currently having vals and keys return seqs in the same > order is not guaranteed by the documentation ? > > Touché. Hard to swallow the own pill. It is not mentioned in the > documen

Re: concurrency example about java x clojure

2010-09-20 Thread Meikel Brandmeyer
Hello Laurent. Am 20.09.2010 um 22:38 schrieb Laurent PETIT: > The fact that currently having vals and keys return seqs in the same order is > not guaranteed by the documentation ? Touché. Hard to swallow the own pill. It is not mentioned in the documentation, but it is chouser's believe that

Re: appengine-magic: using Clojure with Google App Engine

2010-09-20 Thread Saul Hazledine
On Sep 20, 10:15 pm, Constantine Vetoshev wrote: > I'd like to announce the release of a working version of appengine- > magic, a library designed to make it easier to get started with Google > App Engine using Clojure. > > appengine-magic abstracts away nearly all the boilerplate necessary to > d

Re: [ANN] Leiningen 1.3.1

2010-09-20 Thread Phil Hagelberg
On Mon, Sep 20, 2010 at 12:08 PM, Eric Schulte wrote: > Having recently upgraded to this newest lein > >  $ lein --version >  Leiningen 1.3.1 on Java 1.6.0_18 OpenJDK Client VM > > I notice that the "lein swank" command is no longer supported. Hi Eric! The swank command is not built-in to Leinin

Re: concurrency example about java x clojure

2010-09-20 Thread Laurent PETIT
2010/9/20 Meikel Brandmeyer > Hi, > > Am 20.09.2010 um 18:52 schrieb John Cromartie: > > >> (def flip-map #(apply zipmap ((juxt vals keys) %))) > >> > > > > If I was going to write flip-map it might be a tad longer, but lazy > > and a bit clearer (IMO), with: > > > >(defn flip-map [m] (into {

[ANN] appengine-magic: using Clojure with Google App Engine

2010-09-20 Thread Constantine Vetoshev
I'd like to announce the release of a working version of appengine- magic, a library designed to make it easier to get started with Google App Engine using Clojure. appengine-magic abstracts away nearly all the boilerplate necessary to deploy an App Engine application. It also enables interactive

Re: Making Clojure really work with Google App Engine

2010-09-20 Thread Constantine Vetoshev
On Sep 20, 9:17 am, Stefan Kamphausen wrote: > So it might be a good idea to avoid creating threads automatically or > importing file/socket packages. I think you're right. Dependencies are always a double-edged sword, and in the case of App Engine, they are more toxic than usual. Anyway, I elimi

Re: why the big difference in speed?

2010-09-20 Thread Jason Wolfe
I think partition is slowing you down (but haven't profiled to verify). Here's a functional version that's about 70% as fast as my "5": (defn gaussian-matrix6 [L] (to-array (for [i (range L)] (into-array Double/TYPE (for [j (range L)] (next-gaussian)) and I'd guess that's about as good

Re: [ANN] Leiningen 1.3.1

2010-09-20 Thread Eric Schulte
Hi, Having recently upgraded to this newest lein $ lein --version Leiningen 1.3.1 on Java 1.6.0_18 OpenJDK Client VM I notice that the "lein swank" command is no longer supported. $ lein swank That's not a task. Use "lein help" to list all tasks. What's the recommended way to start up

Re: why the big difference in speed?

2010-09-20 Thread Ranjit
Replacing the doseq's with dotimes speeds it up a little more: (defn gaussian-matrix5 [^"[[D" arr] (dotimes [x (alength arr)] (dotimes [y (alength (first arr))] (aset-double ^doubles (aget arr (int x)) (int y) (next- gaussian) but I'm getting reflection warnings on alength. I gues

Re: Displaying source of function typed into the REPL?

2010-09-20 Thread Sean Corfield
On Mon, Sep 20, 2010 at 11:09 AM, Emeka wrote: > Try this, http://gist.github.com/193550 . Adjust  it to your taste. So I'd say (file-repl "console.txt") and everything typed in and printed out would be written to that file for the REPL session? That would be a bit like the .jline-clojure.main.h

Re: Displaying source of function typed into the REPL?

2010-09-20 Thread Emeka
Sean, Try this, http://gist.github.com/193550 . Adjust it to your taste. Regards, Emeka On Mon, Sep 20, 2010 at 4:00 AM, Sean Corfield wrote: > That also sounds pretty useful for development. I may try that as an > exercise... > > This weekend has been a journey through The Joy of Clojure. I

Re: Clojure meetup group listing

2010-09-20 Thread Btsai
I second the motion. Just moved to Edmonton, and have been looking around for fellow Clojurians. I've created an Edmonton meetup (I think), and hopefully some kindred souls will turn up :) On Sep 20, 9:33 am, Andrew Gwozdziewycz wrote: > Hey All, > > I know there are certainly a few groups out

Re: concurrency example about java x clojure

2010-09-20 Thread Meikel Brandmeyer
Hi, Am 20.09.2010 um 18:52 schrieb John Cromartie: >> (def flip-map #(apply zipmap ((juxt vals keys) %))) >> > > If I was going to write flip-map it might be a tad longer, but lazy > and a bit clearer (IMO), with: > >(defn flip-map [m] (into {} (map (juxt second first) m))) Is there some

Re: concurrency example about java x clojure

2010-09-20 Thread Alan
There's no such thing as a lazy map. into uses reduce, which is necessarily not lazy either. Clarity is in the eye of the beholder, of course. I think my version is clearer, but if you replaced second/first with val/key I'd rate them about the same. You might even replace (just val key) with rever

Re: concurrency example about java x clojure

2010-09-20 Thread John Cromartie
On Sep 20, 12:08 pm, Alan wrote: > A few days ago I was thinking about how different it would be to write > flip-map* in Java vs Clojure. A very simple, small program, but easy > to see how Clojure can be more expressive. > > public static Map flipMap(Map map) > { >     Map result = new HashMap(ma

Re: concurrency example about java x clojure

2010-09-20 Thread Alan
Oh, I see you put the word "concurrency" in the subject but don't mention it in your post. I guess my example isn't interesting for you, then. You will get better responses if you put all relevant information in the actual body - the subject is a space to summarize the body, not to add to it. On S

Re: why the big difference in speed?

2010-09-20 Thread Jason Wolfe
Oops, I found aset-double2 with tab completion and figured it was build-in. Forgot it was a utility I built some time ago, a stub for a Java method that does the setting. Also, I got the type hint for the "arr" arg wrong, although it didn't seem to matter. Here's a fixed version in standard Cloj

Clojure meetup group listing

2010-09-20 Thread Andrew Gwozdziewycz
Hey All, I know there are certainly a few groups out there (organized via Meetup.com or otherwise) which I see things posted about from time to time on the list. I'd like to propose that we make an effort to list these groups on Meetup Everywhere (http://www.meetup.com/everywhere), which is a free

Re: concurrency example about java x clojure

2010-09-20 Thread Alan
A few days ago I was thinking about how different it would be to write flip-map* in Java vs Clojure. A very simple, small program, but easy to see how Clojure can be more expressive. public static Map flipMap(Map map) { Map result = new HashMap(map.size()); for (K key : map.keys()) {

Evaluating elements of a vector in order

2010-09-20 Thread Quzanti
Hello I have a vector containing three macro calls. The third macro relies on the first having been fully evaluated. I want to define a macro to declare these three macros in order Call my vector 'stuff' then the following code inside a macro works (doall [(eval (get stuff 0)) (eval (get stuff 1

Re: what's up with user.clj?

2010-09-20 Thread Laurent PETIT
BTW, shouldn't this "user.clj" trick be marked as deprecated, to be removed in a future version ? 2010/9/19 Kevin Downey > you can also run into issues with things being on the classpath for > your project, but not being on the classpath for lein, but user.clj > being on the classpath for both,

Re: Can resultset-seq blow the stack?

2010-09-20 Thread Shantanu Kumar
Yeah this doesn't happen on using lazy-seq. Thanks! Shantanu On Sep 20, 8:52 am, "Stephen C. Gilardi" wrote: > On Sep 19, 2010, at 3:45 PM, Shantanu Kumar wrote: > > > I simulated a similar recursive call and found it > > throws StackOverflowError at 5508 levels deep on a 32-bit Sun JVM (not > >

Re: why the big difference in speed?

2010-09-20 Thread Ranjit
Thanks Jason, this is great. I was confused earlier because I wasn't seeing reflection warnings, but it turns out that was only because I was evaluating the function definitions in the emacs buffer, and the warnings weren't visible. I have a question about gaussian-matrix3 though. What is "aset-

Re: trace facility?

2010-09-20 Thread Michael Wood
On 20 September 2010 14:55, Jeff Rose wrote: > I'd recommend taking a look at the implementation of dotrace (last > function in the file): > > http://github.com/richhickey/clojure-contrib/blob/master/src/main/clojure/clojure/contrib/trace.clj clojure and clojure-contrib have moved from github.com

Re: clojure.contrib.sql and duplicate inserts

2010-09-20 Thread Stephen C. Gilardi
On Sep 20, 2010, at 8:27 AM, Bart J wrote: > Currently, it is not possible to insert duplicate rows > using the clojure.contrib.sql module (specifically, the > insert-values method). > > Please let me know, if I can add this. > > Thanks. Are you saying you want to end up with duplicate rows or

Re: Making Clojure really work with Google App Engine

2010-09-20 Thread Stefan Kamphausen
Hi, just a few days ago I started considering GAE for a (pet-)project. Being able to develop in Clojure on GAE seems like a valuable goal to me. For example, take a look at http://the-deadline.appspot.com which was written that way. So it might be a good idea to avoid creating threads automatica

clojure friendly data warehouse stack

2010-09-20 Thread Jeff Rose
Hi, We are developing a data warehouse to facilitate reporting and data mining for cash register transaction data. It seems like many people in the Clojure community have data warehouse experience, so I wanted to ask for advice from people who have already done this before. Which libraries, data

Re: trace facility?

2010-09-20 Thread Jeff Rose
I'd recommend taking a look at the implementation of dotrace (last function in the file): http://github.com/richhickey/clojure-contrib/blob/master/src/main/clojure/clojure/contrib/trace.clj It let-binds a wrapper function for each of the functions you want to trace, so that within the context of

clojure.contrib.sql and duplicate inserts

2010-09-20 Thread Bart J
Currently, it is not possible to insert duplicate rows using the clojure.contrib.sql module (specifically, the insert-values method). Please let me know, if I can add this. Thanks. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this grou

Re: trace facility?

2010-09-20 Thread Jacek Laskowski
On Mon, Sep 20, 2010 at 1:41 AM, Mike Meyer wrote: > It already exists - it's clojure.contrib.trace (or was - it may have > moved in 1.2). Usage is (dotrace [foo ...] (expression)) and it traces > the foo and ... functions while evaluating (expression). While we're at it, let me ask you a questi

Re: Isn't STM good at building an ant colony?

2010-09-20 Thread Nicolas Oury
If you have a fixed geometry of cells, it is quite easy to have one ref per cell. Which reduce a lot of contention. For example, on a grid where ant can go instead of representing the world as a ref to a matrix, you can represent the world as a matrix of refs. Those refs can then be update concur

Looking for feedback on article about interactive programming / REPL

2010-09-20 Thread Thomas Kjeldahl Nilsson
Hello, Small request from a Clojure/Lisp-newbie: I wrote an article on interactive programming in order to really "get" REPL / interactive work. This style of development is new to me so I'm looking for any suggestions you might have for improvement/aspects which I've overlooked! The article (+