Re: offtopic - where are you come from? (poll)

2008-10-19 Thread Tatu Tarvainen
> So wherever are you come from, be proud and say it. Oulu, Finland. > > I'm from Slovakia. :) > > RK --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@g

Re: Beginners (and idiomatic Clojure)

2008-10-19 Thread Krukow
On Oct 20, 12:30 am, Paul Barry <[EMAIL PROTECTED]> wrote: > Krukow, > > I agree, it would help to have a resource for learning Clojure.  For > now, my best advice is to pick a real project to start working and > then specific questions in the IRC room, #clojure on irc.freenode.net. > > Within a

Re: offtopic - where are you come from? (poll)

2008-10-19 Thread [EMAIL PROTECTED]
Austin, Texas, USA. On Oct 17, 9:18 am, "Eric Rochester" <[EMAIL PROTECTED]> wrote: > Atlanta, Georgia, US > > On Fri, Oct 17, 2008 at 5:27 AM, Rastislav Kassak <[EMAIL PROTECTED]>wrote: > > > > > Hello Clojurians, > > > I think after 1st year of Clojure life it's good to check how far has > > Cl

Re: Clojure + Terracotta

2008-10-19 Thread Alex Miller
Rich, I'm the tech lead for the transparency team at Terracotta and this is not exactly correct. For example, while you can read clustered state outside of a clustered lock, it's possible for the tc memory manager to clear that state at any time, allowing you to see a null instead of the real val

Re: Newbie question on the use of functional hash maps

2008-10-19 Thread wwmorgan
If you're interested only in counting the number of unique words, then you don't even need a map. You can get by with a set, like this: (defn unique-words-in-file [file] (count (set (split-on-whitespace (slurp file) slurp reads file into a String object in memory. The hypothetical spli

Re: Suggestions on handling state for a game...

2008-10-19 Thread wwmorgan
In the game I'm writing, state is held in a single var *state*. Actions are reified and represented by maps. So I have a single function (defmulti execute :Action) that operates on *state* and returns a new state object (state is immutable). So to execute a sequence of actions would look like this

Newbie question on the use of functional hash maps

2008-10-19 Thread Tom Emerson
Hi all, I have a somewhat embarassing newbie question on the use of hash maps in a functional environment. Consider a little utility that counts the number of unique words in a file. A hash map mapping strings to integers is the obvious data structure for this, but the fact that (assoc) returns

Re: Testing Clojure (was Re: Bug? Strange set equality (r1075))

2008-10-19 Thread Michael Beauregard
Ditto. I've been thinking about this for a few weeks and would be happy to help out where I can. On Sun, Oct 19, 2008 at 6:22 PM, Paul Barry <[EMAIL PROTECTED]> wrote: > > I like this idea and I would be willing to contribute. > > On Oct 19, 6:43 pm, "Stephen C. Gilardi" <[EMAIL PROTECTED]> wrote

Re: Testing Clojure (was Re: Bug? Strange set equality (r1075))

2008-10-19 Thread Paul Barry
I like this idea and I would be willing to contribute. On Oct 19, 6:43 pm, "Stephen C. Gilardi" <[EMAIL PROTECTED]> wrote: > On Oct 19, 2008, at 5:11 PM, J. McConnell wrote: > > > I've been thinking the same thing for awhile now and I'd love to help > > contribute to an effort like this. Thanks f

Swank-clojure: slime-eval-print-last-expression failing.

2008-10-19 Thread Luke Hope
Hello, I am a common lisp programmer and I use Slime extensively. I am looking into using Clojure for an upcoming project (I have experience with ABCL, but it is too slow) and I have clojure and swank-clojure installed. Unfortunately slime-eval-print-last-expression (C-j in *slime-scratch*) is f

Testing Clojure (was Re: Bug? Strange set equality (r1075))

2008-10-19 Thread Stephen C. Gilardi
On Oct 19, 2008, at 5:11 PM, J. McConnell wrote: > I've been thinking the same thing for awhile now and I'd love to help > contribute to an effort like this. Thanks for getting the idea out > there. You're welcome. It seems like clojure.contrib could be a more convenient place to keep this th

Re: Beginners (and idiomatic Clojure)

2008-10-19 Thread Paul Barry
Krukow, I agree, it would help to have a resource for learning Clojure. For now, my best advice is to pick a real project to start working and then specific questions in the IRC room, #clojure on irc.freenode.net. Within a few months, we'll have the beta book: http://www.pragprog.com/titles/shc

Re: Bug? Strange set equality (r1075)

2008-10-19 Thread J. McConnell
> As a more general thought, we Clojure users would benefit from a test suite > for the functions (and macros) shipped with the Clojure distribution. This > seems like an ideal thing for members of the community to work together > on--a large effort that can be done in parallel. Any work we do on

Suggestions on handling state for a game...

2008-10-19 Thread Adam Jones
I'm starting up work again on my Clojure-based game. Up until this point I've been doing things the "dirty" way by re-defing a bunch of global variables and/or storing the values in the Java objects I need to use to get access to the game framework. This approach is pretty unwieldy, and means I m

Re: Bug? Strange set equality (r1075)

2008-10-19 Thread Stephen C. Gilardi
On Oct 19, 2008, at 3:02 PM, Achim Passen wrote: > Hi, > > user> (= #{1 4} #{2 3}) > true > > it's not, is it? It's not. Line 62 of APersistentSet.java should be: if (!contains(aM)) rather than if (!m.contains(aM)) As a more general thought, we Clojure users would

Re: Bug? Strange set equality (r1075)

2008-10-19 Thread Rich Hickey
On Oct 19, 3:02 pm, Achim Passen <[EMAIL PROTECTED]> wrote: > Hi, > > user> (= #{1 4} #{2 3}) Fixed - thanks for the report. Rich --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to

Re: Bug? Strange set equality (r1075)

2008-10-19 Thread Chouser
On Sun, Oct 19, 2008 at 3:02 PM, Achim Passen <[EMAIL PROTECTED]> wrote: > >user> (= #{1 4} #{2 3}) >true > > it's not, is it? I hope not! Patch attached. --Chouser --~--~-~--~~~---~--~~ You received this message because you are subscribed to the

Bug? Strange set equality (r1075)

2008-10-19 Thread Achim Passen
Hi, user> (= #{1 4} #{2 3}) true it's not, is it? Kind regards, achim -- http://rauschabstand.twoday.net --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group

Re: Fibonacci function performance compare between clojure and scala

2008-10-19 Thread Meikel Brandmeyer
Hello, Am 19.10.2008 um 17:56 schrieb Lauri Oherd: There is also a faster way to calculate fibonacci numbers in Clojure (code taken from from http://en.wikibooks.org/wiki/Clojure_Programming#Lazy_Fibonacci): (defn fib-seq [] ((fn rfib [a b] (lazy-cons a (rfib b (+ a b 0 1)) user=

Re: Submitting patches

2008-10-19 Thread Rich Hickey
Thanks for the patch! Hang tight, during the work on AOT compilation I've been revisiting whether or not I can bundle the functionality of genclass right into AOT compilation - I think I can, yielding a much streamlined process. At that point, I'll have some syntax for adorning defns with m

Re: offtopic - where are you come from? (poll)

2008-10-19 Thread Johan Berntsson
Tokyo, Japan On Oct 17, 2:27 am, "Rastislav Kassak" <[EMAIL PROTECTED]> wrote: > Hello Clojurians, > > I think after 1st year of Clojure life it's good to check how far has > Clojure spread all over the world. > > So wherever are you come from, be proud and say it. > > I'm from Slovakia. :) > > R

Re: offtopic - where are you come from? (poll)

2008-10-19 Thread J . Pablo Fernández
I think it might be more important where people are, where they live, than where they come from. I live in Zürich, Switzerland. On Oct 17, 11:27 am, "Rastislav Kassak" <[EMAIL PROTECTED]> wrote: > Hello Clojurians, > > I think after 1st year of Clojure life it's good to check how far has > Clojur

Re: Fibonacci function performance compare between clojure and scala

2008-10-19 Thread [EMAIL PROTECTED]
This lazy cached calculate is wonderful ,but i think the benefit from it mostly due to cache . On Oct 19, 11:56 pm, "Lauri Oherd" <[EMAIL PROTECTED]> wrote: > There is also a faster way to calculate fibonacci numbers in Clojure > (code taken from > fromhttp://en.wikibooks.org/wiki/Cloju

Submitting patches

2008-10-19 Thread Matt Revelle
Rich, I submitted a patch that adds support for exposing protected fields inherited indirectly through the super class in gen-class. No problem if it's unwanted, but would be good to know either way. Suppose the original message should've had "patch" in the subject line; it's "exposing ancestra

Re: Fibonacci function performance compare between clojure and scala

2008-10-19 Thread Lauri Oherd
There is also a faster way to calculate fibonacci numbers in Clojure (code taken from from http://en.wikibooks.org/wiki/Clojure_Programming#Lazy_Fibonacci): (defn fib-seq [] ((fn rfib [a b] (lazy-cons a (rfib b (+ a b 0 1)) user=> (time (take 38 (fib-seq))) "Elapsed time: 0.0329

Re: Lazy step ...

2008-10-19 Thread Achim Passen
Hi Steve, thanks for your answer! Am 19.10.2008 um 17:13 schrieb Stephen C. Gilardi: > That looks strictly better than the other examples to me. If you're > willing and if you send a Contributer Agreement to Rich, I'd like to > adopt it in clojure.contrib.lazy-seqs. In the meantime, the wik

Re: Fibonacci function performance compare between clojure and scala

2008-10-19 Thread [EMAIL PROTECTED]
Scala is sure to use java primitive int type underline, i.e value type and boxed to java Integer when necessarily But why not Clojure auto make this ? gerry On Oct 19, 11:31 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Here is coersion version for Clojure > > (defn fib [n] >   (l

Re: Fibonacci function performance compare between clojure and scala

2008-10-19 Thread [EMAIL PROTECTED]
Here is coersion version for Clojure (defn fib [n] (let [n (int n)] (if (or (zero? n) (= n 1)) 1 (+ (fib (dec n) ) (fib (- n 2)) (time (fib 36)) "Elapsed time 8848.865149" not much better and how to type hint for a int type? --~--~-~--~~

Re: Lazy step ...

2008-10-19 Thread Stephen C. Gilardi
On Oct 19, 2008, at 8:49 AM, Achim Passen wrote: > (def fibs (lazy-cat [0 1] (map + fibs (rest fibs That looks strictly better than the other examples to me. If you're willing and if you send a Contributer Agreement to Rich, I'd like to adopt it in clojure.contrib.lazy-seqs. In the

Re: Fibonacci function performance compare between clojure and scala

2008-10-19 Thread Parth Malwankar
On Oct 19, 7:49 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Clojure's > > (defn fib [n] >(if (or (zero? n) (= n 1)) >1 > (+ (fib (dec n) ) (fib (- n 2) > > (time (fib 36)) > > "Elapsed Time: 10475.325226 msecs" > 24157817 > > Scala's > > def fib(n:Int):Int=if (

Re: Fibonacci function performance compare between clojure and scala

2008-10-19 Thread Rastislav Kassak
Just use type hint in Clojure version and you'll see quite a difference in performance. Your scala version is completely optimized / crippled to integers (maybe even unboxed), so there is no dynamic runtime overhead. IMHO, this kind of microbenchmarks are just good for finding general weak point

Fibonacci function performance compare between clojure and scala

2008-10-19 Thread [EMAIL PROTECTED]
Clojure's (defn fib [n] (if (or (zero? n) (= n 1)) 1 (+ (fib (dec n) ) (fib (- n 2) (time (fib 36)) "Elapsed Time: 10475.325226 msecs" 24157817 Scala's def fib(n:Int):Int=if (n==0||n==1)1 else fib(n-1)+fib(n-2) def time(cal: =>Int)={ val beginTime=System.currentTimeMi

Another newbie app example

2008-10-19 Thread Asbjørn Bjørnstad
Hi, I wrote a very simple swing app and wrote a little about it. Mostly aimed at newbies with some lisp knowledge. (map/let is not explained for example) http://blog.jalat.com/2008/10/game-clojure-version.html Even such a small program ended up using quite a bit of clojure stuff: lazy sequences,

Lazy step ...

2008-10-19 Thread Achim Passen
... is not some new form of dance music from the UK, but what appears to be a recurring - dare i say - pattern in the definition of lazy sequences: the combination of lazy-consing and a step function. There are plenty of these in boot.clj and in contrib's lazy-seq.clj. Here's an example (po

Re: CTPOP emulation in JVM

2008-10-19 Thread Rich Hickey
On Oct 19, 5:27 am, Krukow <[EMAIL PROTECTED]> wrote: > I was reading though Phil Bagwells paper "Ideal Hash Trees", when I > encountered this paragraph: > > Note that the performance of the algorithm is seriously impacted > by the poor execution speed of the CTPOP emulation in Java, a problem >

CTPOP emulation in JVM

2008-10-19 Thread Krukow
I was reading though Phil Bagwells paper "Ideal Hash Trees", when I encountered this paragraph: Note that the performance of the algorithm is seriously impacted by the poor execution speed of the CTPOP emulation in Java, a problem the Java designers may wish to address. I am assuming he means t

Re: offtopic - where are you come from? (poll)

2008-10-19 Thread hoeck
Dresden, Germany On Oct 17, 11:27 am, "Rastislav Kassak" <[EMAIL PROTECTED]> wrote: > Hello Clojurians, > > I think after 1st year of Clojure life it's good to check how far has > Clojure spread all over the world. > > So wherever are you come from, be proud and say it. > > I'm from Slovakia. :)

Re: Multiple indexing for vectors/maps

2008-10-19 Thread Meikel Brandmeyer
Hello, Am 19.10.2008 um 00:12 schrieb kwatford: I don't think adding this should conflict with any existing code, though I did notice that "get" currently accepts and apparently ignores one extra parameter. No. It does not ignore the extra parameter! This is a default value, which is returned