Parallel Game of Life

2009-03-15 Thread Scott Fraser
I have taken Larry's "Game of Life" example that he originally posted here: http://groups.google.com/group/clojure/msg/fdfc88f1ba95bdee ...and updated it to use all the CPU's your JVM has access to. My first attempts ran into the classic map -> pmap slowdown. My next attempt had too much dosync,

Re: "08" and "09" are invalid numbers, but "01" through "07" are fine?

2009-03-15 Thread Stephen C. Gilardi
On Mar 15, 2009, at 10:53 PM, Aaron Brooks wrote: So, here's a request -- can we get macro dispatch for other base numbers? The CL notation is reasonable, already known and quite readable. Besides, Clojure tells me it /really/ /wants/ to... ;-) For integers, Clojure currently supports all the

Re: error messages with clojure-mode.el?

2009-03-15 Thread Phil Hagelberg
Raoul Duke writes: > i just tried using (load-file "foo.clj") to see if that loaded file > line numbers, but the errors still say no source found zero sorry > charlie. :-( I use C-c C-k to compile the current buffer via SLIME. It gives a regular backtrace in the *inferior-lisp* buffer for load-

Re: "08" and "09" are invalid numbers, but "01" through "07" are fine?

2009-03-15 Thread David Sletten
On Mar 15, 2009, at 4:53 PM, Aaron Brooks wrote: > > Rather than going to the horrible effort of looking up to see > if Clojure had support for binary notation, I had a Clojure prompt so > I just tried it and got semi-surprising results: > > user=> #b010001 > java.lang.Exception: No dispatch ma

Re: "08" and "09" are invalid numbers, but "01" through "07" are fine?

2009-03-15 Thread Aaron Brooks
Rather than going to the horrible effort of looking up to see if Clojure had support for binary notation, I had a Clojure prompt so I just tried it and got semi-surprising results: user=> #b010001 java.lang.Exception: No dispatch macro for: b 4097 I'm not surprised that Clojure complains of not

Re: swank-clojure: swank-clojure-init-files not used

2009-03-15 Thread Cosmin Stejerean
On Sun, Mar 15, 2009 at 1:41 PM, Tassilo Horn wrote: > > Hi, > > I'd like that slime loads ~/.clojure/user.clj when starting the clojure > REPL. Therefore I added that file to `swank-clojure-init-files'. This > variable is used in `swank-clojure-cmd' to build the java invocation > command line.

java.lang.IllegalArgumentException: Wrong number of args passed to: When using Emacs + SLIME +

2009-03-15 Thread m
Hello, I think that I got a basic EMACS + SLIME + SWANK + Clojure setup on OS X Leopard, but I'm not sure about the behavior of one command. Since I'm new to all of this, I'm not sure which program is to blame and more than likely the problem is probably between the keyboard and chair. When I t

Flickr API bindings for Clojure

2009-03-15 Thread schani
Hey everybody, Once upon a time I wrote bindings for Flickr API for Common Lisp. Now that I'm getting into Clojure I've ported and improved them: http://github.com/schani/flickr-clojure/tree/master Right now the high level interface only supports reading calls. I do plan to implement writin

Re: Game of Life

2009-03-15 Thread Scott Fraser
Hi Larry I have a performance tweak, that gives about an order of magnitude speedup to paint-cells when running this with a large grid and no or little (Thread/sleep life-delay) in toggle-thread. That is how I am running it now - 128 x 192 cells with no delay! It is also noticeably faster on the

Qi's type system

2009-03-15 Thread Vincent Foley
A few months, Rich mentioned Qi's type system on the IRC channel (http://clojure-log.n01se.net/date/2008-12-11.html#10:25) and how it could be applicable in Clojure. From what I gathered from the tweets from Qcon, Qi was mentioned again there. Does anyone know if there was anything more to it th

Re: "08" and "09" are invalid numbers, but "01" through "07" are fine?

2009-03-15 Thread Stephen C. Gilardi
On Mar 15, 2009, at 7:29 PM, Stephen C. Gilardi wrote: I see Common Lisp has *print-base* and *print-radix* that control the base used in printing rational numbers (including integers) and whether or not the printed output includes the base indicator. These wouldn't be hard to implement fo

Re: "08" and "09" are invalid numbers, but "01" through "07" are fine?

2009-03-15 Thread Stephen C. Gilardi
On Mar 15, 2009, at 7:11 PM, André Thieme wrote: This is also available in Clojure: user> 36rCLOJURE 27432414842 I see Common Lisp has *print-base* and *print-radix* that control the base used in printing rational numbers (including integers) and whether or not the printed output includes

Re: "08" and "09" are invalid numbers, but "01" through "07" are fine?

2009-03-15 Thread André Thieme
On 13 Mrz., 14:19, David Sletten wrote: > Common Lisp uses a separate syntax for binary/octal/hex literals. Legal: > #b1011, #o377, #xDEADBEEF, #36rZZZ (Base 36 anyone?) > Illegal: > #b2, #o8, #xQUICKSAND > > (Of course, #36rCLOJURE => 27432414842 :-) ) This is also available in Clojure: user>

Re: Main Function for Program Entry Point

2009-03-15 Thread Stephen C. Gilardi
On Mar 15, 2009, at 4:42 PM, Tom Faulhaber wrote: the :gen-class directive needs (:main true) to tell it you have a main function: (ns temp-converter (:gen-class (:main true)) (:main true) is the default for the :gen-class directive. Here's the relevant portion of (doc ns) (and http://cloj

Re: Main Function for Program Entry Point

2009-03-15 Thread Laurent PETIT
oops, sorry for the argument declaration. Concerning the need to have (:main true), it's weird, because it worked for me without it. 2009/3/15 Tom Faulhaber > > A couple of small corrections: > > the :gen-class directive needs (:main true) to tell it you have a main > function: > > (ns temp-con

Re: Main Function for Program Entry Point

2009-03-15 Thread Tom Faulhaber
A couple of small corrections: the :gen-class directive needs (:main true) to tell it you have a main function: (ns temp-converter (:gen-class (:main true)) and the main function needs an argument declaration: (defn -main [] (main)) Tom On Mar 15, 2:05 am, Laurent PETIT wrote: > Hello, >

Re: filter1 interesting?

2009-03-15 Thread e
> In the > case of an infinite sequence, it may never terminate! So overloading > "first" would conflate two very different behaviors. > in the case of a blocked resource, (which 'filter' falls into) first could never terminate, too. It's a minor matter that it's "filter's" fault, and not "firs

swank-clojure: swank-clojure-init-files not used

2009-03-15 Thread Tassilo Horn
Hi, I'd like that slime loads ~/.clojure/user.clj when starting the clojure REPL. Therefore I added that file to `swank-clojure-init-files'. This variable is used in `swank-clojure-cmd' to build the java invocation command line. But that didn't work. So I wanted to debug `swank-clojure-cmd' t

Re: How to abort a long running operation at the SLIME REPL?

2009-03-15 Thread Tassilo Horn
Raffael Cavallaro writes: Hi Raffael, > > > shows how to do this > > basically, add the following to your user.clj > > (use 'clojure.contrib.repl-utils) > (add-break-thread!) Hm, but C-c C-c only issues a SIGINT if `slime-use-

Re: Loading a self-defined lib

2009-03-15 Thread Tassilo Horn
stephaner writes: Hi Stephane, > Did you include your jar name into you classpath on your REPL starting > script? Yeah, but it seems the jar's content were broken somehow and I didn't recreate it... Bye, Tassilo --~--~-~--~~~---~--~~ You received this message

Re: Loading a self-defined lib

2009-03-15 Thread Tassilo Horn
"Stephen C. Gilardi" writes: Hi Stephen, > I don't see anything to cause that failure in what you posted. Using lists in :only part of the used libs instead of vectors made it work. (This is at the SLIME REPL.) > Could there be another ".clj" file in classpath with the classpath- > relative

Re: VimClojure 2

2009-03-15 Thread Meikel Brandmeyer
Hi, Am 14.03.2009 um 15:10 schrieb Albert Cardona: I have called :split so there are two buffers visible. Then I shift+V and y to copy a line. Then I control+w j to go to the upper window. Then I p, and a new line pastes, not what I copied. To paste, I have to "0p, i.e. paste the last user-yank

Re: Bytecode optimization

2009-03-15 Thread Christophe Grand
Howard Lewis Ship a écrit : > I have to wonder a bit about the ability to optimize. Everything > boils down to one of the seven or so basic forms. That's a lot of > function calls to do even small things, like adding numbers. You might > think that simple math would be optimized and inlined, but

Re: Loading a self-defined lib

2009-03-15 Thread Tassilo Horn
Meikel Brandmeyer writes: Hi Meikel, >> --8<---cut here---start->8--- >> (ns de.tsdh.math.primes >> (:use [clojure.contrib [math :only [expt]] [test-is :only [deftest is]]])) >> --8<---cut here---end--->8--- > > The obviou

Re: How to abort a long running operation at the SLIME REPL?

2009-03-15 Thread Raffael Cavallaro
shows how to do this basically, add the following to your user.clj (use 'clojure.contrib.repl-utils) (add-break-thread!) then whenever you type ctrl-c ctrl-c return, you'll get a break. --~--~-~--~~~-

Re: Loading a self-defined lib

2009-03-15 Thread stephaner
Hi Tassilo, Did you include your jar name into you classpath on your REPL starting script? Stephane On Mar 15, 11:53 am, Tassilo Horn wrote: > Hi, > > when I write a lib with this header > > --8<---cut here---start->8--- > (ns de.tsdh.math.primes >   (:use [

Re: Loading a self-defined lib

2009-03-15 Thread Stephen C. Gilardi
On Mar 15, 2009, at 11:53 AM, Tassilo Horn wrote: Hi, when I write a lib with this header --8<---cut here---start->8--- (ns de.tsdh.math.primes (:use [clojure.contrib [math :only [expt]] [test-is :only [deftest is]]])) --8<---cut here---

Re: Loading a self-defined lib

2009-03-15 Thread Meikel Brandmeyer
Hi, Am 15.03.2009 um 16:53 schrieb Tassilo Horn: --8<---cut here---start->8--- (ns de.tsdh.math.primes (:use [clojure.contrib [math :only [expt]] [test-is :only [deftest is]]])) --8<---cut here---end--->8--- The obvio

Loading a self-defined lib

2009-03-15 Thread Tassilo Horn
Hi, when I write a lib with this header --8<---cut here---start->8--- (ns de.tsdh.math.primes (:use [clojure.contrib [math :only [expt]] [test-is :only [deftest is]]])) --8<---cut here---end--->8--- and create a jar file

How to abort a long running operation at the SLIME REPL?

2009-03-15 Thread Tassilo Horn
Hi all, when experimenting at the SLIME REPL it often happens to me that I eval an expression which runs very long (or infinitively). This may be intended, like to prove that (some #(= 12 %) primes) will run forever (it does). The question is: How do I abort such an evaluation? Currently I do

Re: design patterns for event driven applications

2009-03-15 Thread samppi
When I created fnparse, I had no idea about the existence of Parsec; I just knew about the concept of passing sequences of tokens around. Of course, since Parsec has apparently been around for a long time, the algorithms it uses would be tried, true, and fast. Unfortunately, I can't read Haskell a

Re: filter1 interesting?

2009-03-15 Thread Stuart Sierra
On Mar 15, 7:39 am, André Thieme wrote: > Btw, what do you think about Craigs idea, about overloading first? It's interesting, but I don't think it's a good idea. "first" is guaranteed to consume exactly one element of a sequence. "seek", as we've defined it, potentially consumes the entire se

Re: errors?

2009-03-15 Thread Jeffrey Straszheim
Don't be discouraged. At work I use Eclipse with all sorts of mature tools (this is Java). It is, more or less, pretty easy to use. At home I use Aquamacs with a simple clojure-mode.el. I can produce lines of code many times faster and easier with the later. No doubt a big part reflects the su

Re: design patterns for event driven applications

2009-03-15 Thread Jeffrey Straszheim
Maybe I'll put together a Parsec. I seem to remember it supported a cut operator? That would be fun. On Sat, Mar 14, 2009 at 2:10 PM, Meikel Brandmeyer wrote: > Hi, > > Am 14.03.2009 um 18:42 schrieb Jeffrey Straszheim: > > Hasn't someone been working on a Clojure vesion of Parsec? >> > > I s

Re: filter1 interesting?

2009-03-15 Thread Sean
I would call it "Obvious" On Mar 15, 8:00 am, linh wrote: > I like that, that makes the code selfdescribing (is there such a word > in english?) > > On Mar 14, 2:58 pm, Craig Andera wrote: > > > What about overloading first to accept a predicate? > > > (first even? (iterate inc 1)) => 2 > > > O

Re: filter1 interesting?

2009-03-15 Thread linh
I like that, that makes the code selfdescribing (is there such a word in english?) On Mar 14, 2:58 pm, Craig Andera wrote: > What about overloading first to accept a predicate? > > (first even? (iterate inc 1)) => 2 > > On Sat, Mar 14, 2009 at 8:58 AM, e wrote: > > >> Christophe Grand suggest (

Re: filter1 interesting?

2009-03-15 Thread André Thieme
On 14 Mrz., 16:26, Stuart Sierra wrote: > I've added a "seek" function to clojure.contrib.seq-utils: > > (defn seek >   "Returns the first item of coll for which (pred item) returns > logical true. >   Consumes sequences up to the first match, will consume the entire > sequence >   and return nil

Re: Main Function for Program Entry Point

2009-03-15 Thread Laurent PETIT
Hello, And one more added benefit is that if you (or something using your namespace) uses IDEs that auto-load (or auto-compile) the clj files each time they are saved (such as clojuredev does), it would be impractical to have a namespace auto-execute itself. Because then, the auto-load functionali

Re: Main Function for Program Entry Point

2009-03-15 Thread Timothy Pratley
Hi Keith, IMO it is slightly better to use a function as you described. The benefit being that it makes it easier to test your helper functions without running the main application. For instance if you comment out (main) and load the file to the REPL or call a test function instead. It seems the

Re: Main Function for Program Entry Point

2009-03-15 Thread Joshua Fox
Of course, defining the function makes it easier to invoke your code if you think it might have wider usefulness. Joshua On Sun, Mar 15, 2009 at 3:55 AM, Keith Bennett wrote: > > Is it a good idea or a bad idea to provide a main() function as the > program's entry point? > > As an example, I have

Re: Clojure.main/repl function

2009-03-15 Thread Timothy Pratley
If you are using the default reader, it will exit on end of stream (on unix you can enter this with ctrl-d, windows might be ctrl-z enter, or if you are using a stream just close it) (doc clojure.main/repl) - :read, function of two arguments, reads from *in*: - returns its first arg