Re: Sequential vs. "divide and conquer" algorithm

2010-03-21 Thread Jarkko Oranen
On Mar 19, 6:53 pm, Andrzej wrote: > I've been toying with various implementations of reduce-like > functions, trying to do something "smarter" than a simple iteration > over a collection of data. This hasn't worked out very well, my > implementation is a lot (~50x) slower than a simple loop. Co

Re: Swank, ELPA and Emacs version do you use?

2010-03-21 Thread Rob Wolfe
alux writes: > Okay. So I switched to version 23.1. that had already been installed. > AFAIK it uses all the things I installed the last days. Or do I have > to update some other stuff? I tried to put together all steps needed to install SLIME for Clojure using ELPA: http://wiki.github.com/robwo

Re: Sequential vs. "divide and conquer" algorithm

2010-03-21 Thread Andrzej
On Sun, Mar 21, 2010 at 6:37 PM, Jarkko Oranen wrote: > > Rich has done some work on using the JDK7 ForkJoin Library to > parallelise map and reduce over vectors, since they are already > internally structured as trees. It hasn't been touched in a while, but > as far as I know the code lives in th

Re: How to use Clojure with Robocode

2010-03-21 Thread ubolonton
On Mar 19, 8:19 pm, Jeff Foster wrote: > Could you post the source code? This is the Clojure code (ns ubolonton.MyRobot (:gen-class :extends robocode.Robot)) (defn -run [robot] (doto robot (.ahead 100) (.turnGunRight 360) (.back 100)) (.turnGunRight 360) (recur robot)) (d

Re: How to use Clojure with Robocode

2010-03-21 Thread ubolonton
On Mar 20, 9:46 pm, "Heinz N. Gies" wrote: > Hi, > I hope that in a week or two I am able to release a 'mini game' as a tech > demo for something some friends and me are working on, if you're interested > in Robocode you might like it. It will be a tournament game where two fleets > fight eac

Re: Maven clojure:repl

2010-03-21 Thread Mark Derricutt
The plugin is in central, tho you need to declare it in your project as outlined in the README: com.theoryinpractise clojure-maven-plugin 1.3.2 -- Pull me down under... On Sun, Mar 21, 2010 at 4:55 AM, alux wrote: > Well, so I hope there is THE plugin, and not some plugin

Re: indexing only some elements of a sequence...

2010-03-21 Thread Douglas Philips
On 2010 Mar 20, at 10:40 AM, Steve Purcell wrote: Which looks the same as clojure.contrib.seq/reductions to me... On 20 Mar 2010, at 13:54, Per Vognsen wrote: Learn to love scan: http://gist.github.com/338682 Thanks Per and Steve! I knew there was catch that I wasn't seeing. I did see red

Check my idioms?

2010-03-21 Thread Mark J. Reed
(I'd say something about my own particular idiom, but that's more of a Python thing.) Anyway, new to Clojure but not to Lisp or Java. Writing something to interoperate with some Perl code that stores a hash in a simple flat file syntax: key1value1key2value2... sorted on the keys. These are my

General question: Petri nets and STM in clojure

2010-03-21 Thread Ryan Teo (SG)
Hi everyone, I just chanced upon Petri nets and struggling to understand the theory. However, a knowledge of it seems to help design concurrent systems and provide a theoretical basis for the points raised by Rich in the explanation of how time is derived from local causality. I think it's som

Clojure and JMS - Sample program

2010-03-21 Thread jsrodrigues
I wrote this program to help me explore and understand JMS-Queue (javax.jms.Queue). I was working with OpenJMS which comes bundled with the GlassFish application server (running on Windows). In addition to installing JDK-EE 1.5+GlassFish, you will need to include the following jars in your Clojure

Re: Maven clojure:repl

2010-03-21 Thread alux
Thank you Mark, now I get two new problems. (I'm still in the testproject, not in incanter.) clojure:repl The REPL starts. Now when I type something in, it is not echoed until I hit enter. So I have to use the REPL blind. Difficult. clojure:swank This has already been described as a windows prob

Re: Check my idioms?

2010-03-21 Thread Justin Kramer
Check out clojure.contrib.io (Clojure 1.2) or clojure.contrib.duck- streams (Clojure 1.1): (use 'clojure.contrib.io) (defn save-map [f m] (write-lines f (for [[k v] m] (str k \tab v Or, using your code... (defn save-map [f m] (spit f (apply str (interleave (apply concat m) (cycle "\t\n")

Re: Swank, ELPA and Emacs version do you use?

2010-03-21 Thread alux
Thank you Rob, emacs and slime already works if kept for semselves. What doesnt work is the maven integration, so I can start the swank server in a certain project. Regards, alux Rob Wolfe schrieb: > alux writes: > > > Okay. So I switched to version 23.1. that had already been installed. > > AFA

Re: separating ui and content in clojure

2010-03-21 Thread Josh Stratton
An atom seems appropriate after reading up on it, but documentation seems a little scarce. Reading about atoms on the clojure site gives a very small example using just a {}. I've tried piecing it together using a struct but am getting Exception in thread "main" java.lang.IllegalArgumentExceptio

Re: Maven clojure:repl

2010-03-21 Thread Stuart Sierra
On Mar 20, 7:56 am, alux wrote: > mvn clojure:repl > > But that doesnt work. > > [ERROR] BUILD ERROR > [INFO] > > [INFO] The plugin 'org.apache.maven.plugins:maven-clojure-plugin' does > not exist Those instructions appear t

Why I have chosen not to employ clojure

2010-03-21 Thread Tim Johnson
I have evaluated clojure for the last couple of days, and it is both my own professional decision and my recommendation to the professional organizations that I belong to and report to that clojure is not ready for prime time. Before any of you think that I am a disgruntled newbie turned troll, kn

Re: Why I have chosen not to employ clojure

2010-03-21 Thread Fogus
> 1)As soon as I see the copy of this email in my "clojure mailbox", I will > unsubscribe from this mailing list, delete the clojure mailbox and I will not > be following up in any way. Really? This is not c.l.l and it's not likely that this thread would have devolved into flaming or worse. It's

Re: Maven clojure:repl

2010-03-21 Thread alux
Hello Stuart, yes, thats not in. I'm not enough into maven to know where the plugins have to be specified. I had the hope that maven searches its repository, when I call a specific goal of the form xxx:yyy - so this hope was in vain? Thank you for the comment. Regards, alux Stuart Sierra schri

Question about overriding print-method for deftypes

2010-03-21 Thread Mark Engelberg
Consider the following deftype: (deftype Piece [#^int number #^char letter]) (def piece (Piece 1 \A)) Now, when I evaluate piece at the REPL, I want it to print: 1A rather than #:Piece{:number 1, :letter \A} similarly, I would like (str piece) to yield "1A". A while back, I was told on this lis

Question about overriding print-method for deftypes

2010-03-21 Thread Mark Engelberg
Consider the following deftype: (deftype Piece [#^int number #^char letter]) (def piece (Piece 1 \A)) Now, when I evaluate piece at the REPL, I want it to print: 1A rather than #:Piece{:number 1, :letter \A} similarly, I would like (str piece) to yield "1A". A while back, I was told on this lis

Re: Question about overriding print-method for deftypes

2010-03-21 Thread Michał Marczyk
On 21 March 2010 20:10, Mark Engelberg wrote: > I have tried things like: > (defmethod clojure.core/print-method ::Piece [piece writer] (do (pr (:number > piece) writer) (pr (:letter piece) writer))) > but it doesn't work. You need to replace pr with print-method inside the do. pr doesn't accept

Re: For loop question

2010-03-21 Thread Michał Marczyk
On 20 March 2010 17:17, David Nolen wrote: > You can do what you want with the following: > > (doseq [[x y] (for [y (range 4) x (range 4)] [x y])] >   (println x y)) Or just (doseq [y (range 4) x (range 4)] (println x y)) doseq really has exactly the same syntax as for (including supp

Re: Question about overriding print-method for deftypes

2010-03-21 Thread Fogus
> (defmethod clojure.core/print-method ::Piece [piece writer] ???what goes > here???) (defmethod clojure.core/print-method ::Piece [piece writer] (.write writer (str (:number piece) (:letter piece)) 0 2)) Extending Piece to provide a str method can replace that ugly bit in the middle. -m --

Re: Question about overriding print-method for deftypes

2010-03-21 Thread Mark Engelberg
Speaking of overriding methods, what am I doing wrong here: (deftype Piece [#^int number #^char letter] Comparable (compareTo [x y] (let [c1 (compare (:number x) (:number y))] (if (zero? c1) (compare (:letter x) (:letter y)) c1 What other interesting things can be overridden for

Re: Question about overriding print-method for deftypes

2010-03-21 Thread Michał Marczyk
On 21 March 2010 20:34, Fogus wrote: > Extending Piece to provide a str method can replace that ugly bit in > the middle. But how would one go about that? str calls .toString on its arguments, which is in turn a method of Object, thus not present in any interface, whereas deftype / extend only al

Re: Question about overriding print-method for deftypes

2010-03-21 Thread Michał Marczyk
On 21 March 2010 20:40, Mark Engelberg wrote: > Speaking of overriding methods, what am I doing wrong here: > (deftype Piece [#^int number #^char letter] >   Comparable >   (compareTo [x y] >     (let [c1 (compare (:number x) (:number y))] >   (if (zero? c1) (compare (:letter x) (:letter y)) c

Re: Swank, ELPA and Emacs version do you use?

2010-03-21 Thread Cosmin Stejerean
On Sat, Mar 20, 2010 at 2:46 PM, alux wrote: > Sorry to have so many questions. > > I lookes at swank at github, it says it supports Emacs 23 and up; and > I should use ELPA to install it. > > The ELPA install page, explains how to install stuff for Emacs 21 and > 22. > > As far as I understand,

Re: Question about overriding print-method for deftypes

2010-03-21 Thread Mark Engelberg
I'm kind of surprised that *print-dup* behavior isn't automatically enabled for deftypes. Is there a standard way to add this in for a specific deftype? -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@goog

Re: Sequential vs. "divide and conquer" algorithm

2010-03-21 Thread Michał Marczyk
On 20 March 2010 18:29, Andrzej wrote: > Thanks, that's what I was going to do next. You're certainly right > about using fewer, more coarse-grained partitions. BTW, you can check > the number of available processors using (.. Runtime getRuntime > availableProcessors) (that's how pmap is doing it)

Re: Why I have chosen not to employ clojure

2010-03-21 Thread Cosmin Stejerean
On Sun, Mar 21, 2010 at 1:47 PM, Fogus wrote: > > 1)As soon as I see the copy of this email in my "clojure mailbox", I will > > unsubscribe from this mailing list, delete the clojure mailbox and I will > not > > be following up in any way. > > Really? This is not c.l.l and it's not likely that t

Re: Why I have chosen not to employ clojure

2010-03-21 Thread Quzanti
Reading his post I got the impression he was a bit of an egocentric (a bit more information about himself than was relevant), those sorts tend to overreact. However I can imagine the whole just bung the jar file on your classpath thing wouldn't make much sense for a java newbie. It may highlight

Re: Sequential vs. "divide and conquer" algorithm

2010-03-21 Thread Michał Marczyk
On 21 March 2010 13:29, Andrzej wrote: > Yesterday I looked at the implementation of the PersistentVector > class, trying to figure out how to exploit its internal structure to > decompose the vector. I hit several issues though: One thing that comes to my mind after reading through your list is

Re: Why I have chosen not to employ clojure

2010-03-21 Thread Laurent PETIT
Yeah, too bad he removed his entry, 'cause as you said, installing clojure isn't harder than installing anything java based. I don't know of a sysadmin nowadays which had not to deal with java stuff in a way or another ? And ant is around the place *for years*. So more input from him may have help

Re: Question about overriding print-method for deftypes

2010-03-21 Thread Michał Marczyk
On 21 March 2010 21:02, Mark Engelberg wrote: > I'm kind of surprised that *print-dup* behavior isn't automatically enabled > for deftypes.  Is there a standard way to add this in for a specific > deftype? print-dup is just another multimethod, so an implementation of that can be defined. Obvious

Re: Why I have chosen not to employ clojure

2010-03-21 Thread Quzanti
But if he had never been in the Java mindset it wouldn't be obvious to him that there is nothing to be gained by compiling your own java code. Platform independence, bytecode etc means that a jar file of the stable build is the optimum solution. That is so obvious to us we forget that its a revolut

Re: Why I have chosen not to employ clojure

2010-03-21 Thread cageface
What a strange reason to dismiss Clojure. And also strange to refuse any further input. -- 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 - plea

Re: Why I have chosen not to employ clojure

2010-03-21 Thread Stuart Sierra
I agree that the Clojure first-run experience is too rough. Both Scala and JRuby, for example, are complete packages that you can download, unzip, install, and run -- on any platform -- without knowing anything about Java. Clojure needs to provide the same experience, even if it only matters for

Re: separating ui and content in clojure

2010-03-21 Thread Mike Meyer
[Context recovered from top-posting.] On Sun, 21 Mar 2010 10:31:58 -0700 Josh Stratton wrote: > On Sat, Mar 20, 2010 at 8:51 AM, Mike Meyer > wrote: > > On Sat, 20 Mar 2010 08:11:49 -0700 (PDT) > > strattonbrazil wrote: > > > >> I'd like to separate my ui Swing/JOGL from the content, so my code

Re: Why I have chosen not to employ clojure

2010-03-21 Thread Lee Spector
I have some sympathy with some of what Tim wrote, although I think that I'll be working in and enjoying Clojure for some time to come (really -- I'm finding it to be fantastic in many ways -- including the community). I'm not sure I agree with or even understand all of Tim's complaints, but as

Re: Question about overriding print-method for deftypes

2010-03-21 Thread Meikel Brandmeyer
Hi, On Sun, Mar 21, 2010 at 08:43:10PM +0100, Michał Marczyk wrote: > But how would one go about that? str calls .toString on its arguments, > which is in turn a method of Object, thus not present in any > interface, whereas deftype / extend only allow one to implement > interface or protocol met

Re: Maven clojure:repl

2010-03-21 Thread Stuart Sierra
Maven has a default search path, but it only works for the standard plugins distributed by Apache. To use the Clojure plugin (any of the clojure:* commands) the pom.xml must contain a section like this: ... ... com.theoryinpractise clojure-maven-plugin

Re: clojure.walk

2010-03-21 Thread Stuart Sierra
clojure.walk is a terrible hack that I wrote and abandoned 2 years ago. It never should have made it into the Clojure distribution, for which I apologize. I will campaign for its deletion just as soon as I find a suitable replacement. -SS -- You received this message because you are subscribed

Re: Why I have chosen not to employ clojure

2010-03-21 Thread Anniepoo
It certainly does seem strange coming from the Java world, where ear files and deployment descriptors can be intimidating. The idea that adding a couple jar files and the source tree to the classpath is 'too hard' makes me wonder what language he was coming from. I was asked to give a simple 'hand

Re: separating ui and content in clojure

2010-03-21 Thread Stuart Sierra
Here's an example I wrote about separating GUI from content using Agents: http://stuartsierra.com/2010/01/08/agents-of-swing -SS On Mar 20, 11:11 am, strattonbrazil wrote: > I'd like to separate my ui Swing/JOGL from the content, so my code is > relatively unaware of the UI around it.  For examp

Re: Why I have chosen not to employ clojure

2010-03-21 Thread Cosmin Stejerean
On Sun, Mar 21, 2010 at 5:05 PM, Stuart Sierra wrote: > I agree that the Clojure first-run experience is too rough. Both > Scala and JRuby, for example, are complete packages that you can > download, unzip, install, and run -- on any platform -- without > knowing anything about Java. > > Clojure

Re: Why I have chosen not to employ clojure

2010-03-21 Thread Mark Derricutt
Thanks for the pointer to MCLIDE! That looks really nice! Any idea if a 64bit build is in the works? For some reason I feel dirty about having to install Rosetta :) -- Pull me down under... On Mon, Mar 22, 2010 at 11:08 AM, Lee Spector wrote: > I'm sure that this can and will be overcome, in

Re: Why I have chosen not to employ clojure

2010-03-21 Thread e
there's a positive reason to say all that stuff as if to say, " and it's not that I'm a slouch. I have been able to succeed with other technology." I've personally had tons of trouble getting going with clojure, and I use java all the time. I think the ideas in clojure are awesome, and I like th

Re: General question: Petri nets and STM in clojure

2010-03-21 Thread alux
Hello Ryan, as far as I understand, Petri nets are as powerful as any concurrent mechanism. That means you can do all the good things Clojure does, and all the bad things (the other languages do :) too in Petri nets. So, can you detail your question a bit more? (I'd be happy about a Petri net to

Re: Why I have chosen not to employ clojure

2010-03-21 Thread Marek Kubica
On Sun, 21 Mar 2010 10:42:12 -0800 Tim Johnson wrote: > Here's how I installed the flash player on my system. > 1)Downloaded install_flash_player_10_linux.tar.gz > 2)Unzipped libflashplayer.so > 3)Copied to /usr/lib/firefox-3.5.2/plugins/ Here's how I installed the Clojure REPL on my system. 1)

clojure and clojure-contrib jars built with the 1.5 jdk

2010-03-21 Thread Eric Thorsen
This is more of a maven question probably, but I have an app that needs versions of the jars built with jdk 1.5 and I'm using the http://build.clojure.org/snapshots repo where they appear to be built with 1.6. Are there versions (or plans to support 1.5 versions) in a maven repo somewhere? Thanks

Re: Why I have chosen not to employ clojure

2010-03-21 Thread Mike K
> I would appreciate any feedback. According to the readme it requires bash or zsh. Any plans to support windows (without cygwin or other unix emulation)? I agree with Stuart that the user experience should be friendly on all supported platforms. Mike -- You received this message because y

Re: clojure and clojure-contrib jars built with the 1.5 jdk

2010-03-21 Thread Stuart Sierra
No, but you can change the configs and recompile. Clojure itself uses Ant, so "ant" on a machine with only Java 1.5 should do the trick. To install that custom JAR in your local Maven repository, download the "Maven Ant Tasks" JAR and run: ant -lib /path/to/maven-ant-tasks.jar ci-build Contrib u

Re: clojure and clojure-contrib jars built with the 1.5 jdk

2010-03-21 Thread Eric Thorsen
I figured as much. The issue for me is the Netbeans plugin must have 1.5 java and I was hoping to get these from a repo. I suppose I can build the 1.5 versions and publish them (somewhere). I'll look into this. Thanks, Eric On Mar 21, 8:50 pm, Stuart Sierra wrote: > No, but you can change th

Re: Why I have chosen not to employ clojure

2010-03-21 Thread Antony Blakey
On 22/03/2010, at 9:28 AM, e wrote: > And don't get me started on trying to get emacs or vi all hooked up on my > mac. I've never succeeded. I'm about to use Clojure commercially, but it's been a frustrating exercise getting setup. I've ended up using LaClojure on IntelliJ, but that wasn't t

Re: Why I have chosen not to employ clojure

2010-03-21 Thread Richard Newman
To be successful however Clojure needs to adopt 'mainstream' values - introduce just one 'different' thing i.e. the language, rather than expecting people to adopt both the language, and a different development environment / toolchain e.g. leiningen etc (which IMO is classic NIH). I think

Re: Why I have chosen not to employ clojure

2010-03-21 Thread David Nolen
On Sun, Mar 21, 2010 at 9:12 PM, Antony Blakey wrote: > > On 22/03/2010, at 9:28 AM, e wrote: > > > And don't get me started on trying to get emacs or vi all hooked up on my > mac. I've never succeeded. > > I'm about to use Clojure commercially, but it's been a frustrating exercise > getting setu

Getting an arbitrary element from a transient hash-set

2010-03-21 Thread Mark Engelberg
On a set s, you can just do (first s) to get an arbitrary element of s. Any way to get an arbitrary item for a transient set? -- 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

Re: Why I have chosen not to employ clojure

2010-03-21 Thread Terje Norderhaug
On Mar 21, 2010, at 3:56 PM, Mark Derricutt wrote: Thanks for the pointer to MCLIDE! That looks really nice! Any idea if a 64bit build is in the works? For some reason I feel dirty about having to install Rosetta :) MCLIDE 2.0 will have that cutting edge you're craving for and definitel

Re: Sequential vs. "divide and conquer" algorithm

2010-03-21 Thread Andrzej
On Sun, Mar 21, 2010 at 1:04 PM, Matt wrote: > Throwing in my 2 cents: > > (def chunk-size 2000) > > (defn sum-tree-part [nums start length] >  (reduce >    #(+ %1 (nth nums (+ start %2))) >    0 >    (range length))) > > (defn sum-partition[nums] >  (reduce + >    (pmap #(sum-tree-part nums % chu

Re: Why I have chosen not to employ clojure

2010-03-21 Thread Cosmin Stejerean
On Sun, Mar 21, 2010 at 6:55 PM, Mike K wrote: > > I would appreciate any feedback. > > According to the readme it requires bash or zsh. Any plans to support > windows (without cygwin or other unix emulation)? > > I agree with Stuart that the user experience should be friendly on all > supported

Re: Why I have chosen not to employ clojure

2010-03-21 Thread Seth
I hate to feed trolls, but this is a solid example of passive- aggresive behavior. Also, ignoring plausible sounding, spell-checked diatribes is bad. The installation of one or two jar files from a Maven repository is par for the JVM course. Deployment? Works on any reasonable JVM out there. Could

Re: General question: Petri nets and STM in clojure

2010-03-21 Thread Andrzej
On Mon, Mar 22, 2010 at 4:36 AM, alux wrote: > > as far as I understand, Petri nets are as powerful as any concurrent > mechanism. That means you can do all the good things Clojure does, and > all the bad things (the other languages do :) too in Petri nets. I wonder if Petri nets can be applied f

Re: Why I have chosen not to employ clojure

2010-03-21 Thread Luc Préfontaine
He's illiterate about Java, he's older than me and has less experience so finding how to run a jar file is probably as remote as traveling to Alpha Centauri :))) (Don't we have something like Google to find these answers ?) Most of his recent experience seems to be in Visual Basic and mainstream

Re: Why I have chosen not to employ clojure

2010-03-21 Thread Cosmin Stejerean
On Sun, Mar 21, 2010 at 10:20 PM, Luc Préfontaine < lprefonta...@softaddicts.ca> wrote: > > Yes we could have a complete package to run Clojure from the shell command > line but how far could someone go with this > to build a workable system without an IDE ? > [...] > Comments anyone ? > > I ca

Re: Question about overriding print-method for deftypes

2010-03-21 Thread Michał Marczyk
On 21 March 2010 23:19, Meikel Brandmeyer wrote: > The docstring of deftype says protocol, interface or Object. So it does. (My, do I feel silly now.) Thanks! Sincerely, Michał -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group,

Re: Why I have chosen not to employ clojure

2010-03-21 Thread cej38
I am a physicist by training and practice, this means that I am an expert on Fortran 95. To say my exposure to Java is minimal would be generous. And until last year when I heard about Clojure from a friend, I thought LISP was a speech impediment. Setting up Clojure was a MAJOR problem for me, w

Re: Why I have chosen not to employ clojure

2010-03-21 Thread Luc Préfontaine
An IDE becomes a necessity as the complexity of your software is increasing. Now what's a complex piece of software ? Presently we have 12 components in production some being several thousand lines covering three languages (Java, Ruby and Clojure). 4 others components are in progress. Add to this

Printing promises

2010-03-21 Thread Per Vognsen
The print-method for IDerefs by default dereferences anything to be printed. Right now it has a special type check for futures but not for promises. It makes promises nearly impossible to debug or to use from the REPL. The current implementation of promises uses reify rather than deftype, so there

Re: Printing promises

2010-03-21 Thread Meikel Brandmeyer
Hi, On Mar 22, 7:13 am, Per Vognsen wrote: > As a solution, I factored the reify out into a deftype: > > http://gist.github.com/339834 A short note: you don't have to use :keyword notation in the methods. The attributes of the type are available under their names. See here: http://paste.pocoo.o

Re: Why I have chosen not to employ clojure

2010-03-21 Thread Miron Brezuleanu
Hello all, On Sun, Mar 21, 2010 at 8:42 PM, Tim Johnson wrote: > I have evaluated clojure for the last couple of days, and it is both my own > professional decision and my recommendation to the professional organizations > that I belong to and report to that clojure is not ready for prime time. >