Why so?

2010-09-02 Thread vishy
It is better to have 100 functions operate on one data structure than 10 functions on 10 data structures. -- Alan Perlis Why so? How is it advantageous? -- 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: Thinking in Clojure

2010-09-02 Thread Sean Corfield
On Thu, Sep 2, 2010 at 6:29 PM, HB wrote: > Usually we create some domain entities, map them with Hibernate/ > iBatis. > I don't know how a Clojure application would be build without objects. I wonder if watching this talk by Rich Hickey will help? http://www.infoq.com/presentations/Are-We-There

Shootout "fannkuch"

2010-09-02 Thread Miki
Hello, I've tried writing a a solution to shootout "fannkuch" (http:// shootout.alioth.debian.org/u32/performance.php?test=fannkuchredux), however I seem to have a bug in the checksum. Is it just the order of permutations or am I missing something? Code at http://bitbucket.org/tebeka/shootout-clj

Re: Thinking in Clojure

2010-09-02 Thread Miki
I'd go over SICP, though it not in Clojure but in Scheme - it will show you how to "think" functional. On Sep 2, 6:29 pm, HB wrote: > Hey, > I finished reading "Programming Clojure" and "Practical Clojure" and > I'm hooked :) > Please count me in the Clojure club. > But I failed how to think in C

Re: union using a comparison function

2010-09-02 Thread Robert McIntyre
By union do you mean union as in sets, or just smashing the two lists together? --Robert McIntyre On Thu, Sep 2, 2010 at 11:10 AM, mlimotte wrote: > Hi. > > I'd like to do a union of some sequences using my own comparison > function.  Similar to supplying a Comparator in Java.  The things > bein

Re: Thinking in Clojure

2010-09-02 Thread Wilson MacGyver
I highly recommend "Joy of Clojure". It's a good "2nd book on clojure". It shows you the "why things are the way they are", and how to do things the clojure way as much as possible. On Thu, Sep 2, 2010 at 9:29 PM, HB wrote: > Hey, > I finished reading "Programming Clojure" and "Practical Clojure"

Re: Thinking in Clojure

2010-09-02 Thread HB
So in idiomatic Clojure applications, maps are considered like objects? And to operate on them we pass them to functions? On Sep 3, 4:55 am, David Nolen wrote: > On Thu, Sep 2, 2010 at 9:29 PM, HB wrote: > > Hey, > > I finished reading "Programming Clojure" and "Practical Clojure" and > > I'm ho

Re: Thinking in Clojure

2010-09-02 Thread David Nolen
On Thu, Sep 2, 2010 at 9:29 PM, HB wrote: > Hey, > I finished reading "Programming Clojure" and "Practical Clojure" and > I'm hooked :) > Please count me in the Clojure club. > But I failed how to think in Clojure. > My main career is around Java web applications (Hibernate, Spring, > Lucene) and

Re: Does 'require' with the :reload option have a tendency to build up memory?

2010-09-02 Thread Chouser
On Thu, Sep 2, 2010 at 7:47 PM, Rayne wrote: > I've got a curious little bit of a memory leak of sorts that I'm > trying to narrow down. > > I have an application (betcha can guess what it is if you know me from > IRC :>) that, in order to reload plugins, requires each of them with > the :reload o

Thinking in Clojure

2010-09-02 Thread HB
Hey, I finished reading "Programming Clojure" and "Practical Clojure" and I'm hooked :) Please count me in the Clojure club. But I failed how to think in Clojure. My main career is around Java web applications (Hibernate, Spring, Lucene) and Web services. Lets not talk about Java web frameworks nei

Re: Blogs/Twitter accounts about Clojure

2010-09-02 Thread HB
This is amazing, thank you all guys :) On Sep 2, 7:33 pm, Sean Allen wrote: > a few off the top of my head: > > @fogus > @planetclojure > @disclojure > @stuartholloway > @liebke > @richhickey > > blog.fogus.me > dosync.posterous.com > m.3wa.com > nathanmarz.com > > > > On Thu, Sep 2, 2010 at 12:2

Re: Clojure 1.2 and the Computer Language Benchmarks Game

2010-09-02 Thread Isaac Gouy
On Sep 2, 5:28 pm, Sean Corfield wrote: > On Wed, Sep 1, 2010 at 9:46 PM, John Fingerhut > wrote: > > You can see a brief summary of results comparing > > run time, memory, and code size against "Java 6 -server" here: > >http://shootout.alioth.debian.org/u32/benchmark.php?test=all〈=clo... > >

Re: Web Development - templating?

2010-09-02 Thread Sean Corfield
On Wed, Sep 1, 2010 at 5:41 AM, Remco van 't Veer wrote: > If you want something old school like CFML you might consider using > plain JSP and taglibs.  These are modeled after CFML and available on > every web container by default. FWIW, I've created a small CFML/Clojure bridge so now I can deve

Re: Clojure 1.2 and the Computer Language Benchmarks Game

2010-09-02 Thread Sean Corfield
On Wed, Sep 1, 2010 at 9:46 PM, John Fingerhut wrote: > You can see a brief summary of results comparing > run time, memory, and code size against "Java 6 -server" here: > http://shootout.alioth.debian.org/u32/benchmark.php?test=all&lang=clojure&lang2=java Very interesting. Clojure is faster than

Re: API for ClojureDocs.org

2010-09-02 Thread Rayne
Awesome! It doesn't have to be much. Searching for examples and docs is the most important thing, obviously. I'd request that if you're going to have any single format, JSON would make me the happiest. Clojure data structures would be cool, but that's kind of limited to Clojure. My vote is on JSON

Re: Clojure 1.2 and the Computer Language Benchmarks Game

2010-09-02 Thread Isaac Gouy
On Sep 1, 9:46 pm, John Fingerhut wrote: > Thanks to many people on this list in Aug 2009 who helped improve my code, > to Johannes Friestad for writing a nice fast Clojure program using deftype > for the n-body problem, to Isaac Gouy for setting up the shootout web site > to accept Clojure subm

Does 'require' with the :reload option have a tendency to build up memory?

2010-09-02 Thread Rayne
I've got a curious little bit of a memory leak of sorts that I'm trying to narrow down. I have an application (betcha can guess what it is if you know me from IRC :>) that, in order to reload plugins, requires each of them with the :reload option whenever you ask them to be reloaded. Each of thes

API for ClojureDocs.org

2010-09-02 Thread Lee Hinman
Hi All, As Zach announced in the ClojureDocs mailing list [1], I'm going to be working on the API for ClojureDocs.org in the coming future. I was hoping to get some feedback regarding what people wanted to see for an API for ClojureDocs: - What kind of features would you like to see in the Clojure

Re: building new contrib against a specific clojure jar

2010-09-02 Thread braver
On Sep 2, 5:24 pm, Stuart Sierra wrote: > You'll need to adjust the version numbers for the Clojure > dependencies.  These are configured in clojure-contrib/modules/parent/ > pom.xml at the line: > >   >     1.2.0 > > Change that to 1.3.0-SNAPSHOT for the latest snapshot (including the > ones you

Re: building new contrib against a specific clojure jar

2010-09-02 Thread Stuart Sierra
You'll need to adjust the version numbers for the Clojure dependencies. These are configured in clojure-contrib/modules/parent/ pom.xml at the line: 1.2.0 Change that to 1.3.0-SNAPSHOT for the latest snapshot (including the ones you build locally) or set it to a specific snapshot version

building new contrib against a specific clojure jar

2010-09-02 Thread braver
I usually git pull clojure, ant, mvn install, then git pull and build clojure-contrib against it. There used to be a -Dclojure.jar=... option mentioned in README.txt for the contrib. The new modular version, however, doesn't mention it, just saying, use these contrib versions for those clojure on

Re: Blogs/Twitter accounts about Clojure

2010-09-02 Thread Matthias Schneider
Shameless self-promotion: http://clojurls.com (like hackurls.com, but only clojure content only) On 2 Sep., 18:21, HB wrote: > Hey, > Would you please recommend some good Blogs/Twitter accounts about > Clojure? > Thanks. -- You received this message because you are subscribed to the Google Grou

Re: Blogs/Twitter accounts about Clojure

2010-09-02 Thread Bruce Durling
Hi, On Thu, Sep 2, 2010 at 17:21, HB wrote: > Hey, > Would you please recommend some good Blogs/Twitter accounts about > Clojure? I irregularly maintain a list here: https://twitter.com/#/list/otfrom/clojure -- You received this message because you are subscribed to the Google Groups "Clojure"

Google has agreed to continue to host the NYC Clojure users group meetings! We need speakers.

2010-09-02 Thread Eric Thorsen
Special thanks to Andrey Fedorov for making this happen for us! If you are in the tri-state area and would like to present at the Clojure NYC @google, please contact me with the topic and we'll get it setup. Thanks, Eric -- You received this message because you are subscribed to the Google Grou

Re: Blogs/Twitter accounts about Clojure

2010-09-02 Thread nickikt
http://planet.clojure.in/ is all i really need :) On 2 Sep., 18:21, HB wrote: > Hey, > Would you please recommend some good Blogs/Twitter accounts about > Clojure? > Thanks. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, sen

Re: Extending Clojure's STM with external transactions

2010-09-02 Thread Mike Meyer
On Wed, 1 Sep 2010 15:14:45 -0700 (PDT) Alyssa Kwan wrote: > I'll go one step further and say that we shouldn't have to call > "persist namespace". It should be automatic such that a change to the > state of an identity is transactionally written. > > Let's start with refs. We can tackle the o

Re: multiple parameters passed to fns

2010-09-02 Thread Glen Rubin
good suggestions guys!! thx so much On Sep 2, 10:44 am, Justin Kramer wrote: > A couple other things: > 1) (apply identity ...) is the same as (first ...) > 2) Consider using the ->> macro to clean up the let > > Here's a quick rewrite: > > (defn make-target >   ([file channel sweepidx] >      (

Re: Blogs/Twitter accounts about Clojure

2010-09-02 Thread Sean Allen
a few off the top of my head: @fogus @planetclojure @disclojure @stuartholloway @liebke @richhickey blog.fogus.me dosync.posterous.com m.3wa.com nathanmarz.com On Thu, Sep 2, 2010 at 12:21 PM, HB wrote: > Hey, > Would you please recommend some good Blogs/Twitter accounts about > Clojure? > Th

json parsing issues with apache cxf integration

2010-09-02 Thread himangshu
I am trying to build a rest webservice using compojure/ring and json marshalling. the consumers of the web service are written in java and we are thinking of using apache cxf. when i am trying to send an object using jsonprovider , it is getting correctly parsed at the client end but on using ring

Re: multiple parameters passed to fns

2010-09-02 Thread Mike Meyer
On Thu, 2 Sep 2010 05:54:26 -0700 (PDT) Glen Rubin wrote: > I defined a fn whose execution depends on the number of parameters > passed to it. It works fine! I am just concerned that I am doing > this in a way that is not as concise as it could or should be. Here > is my fn: > > (defn make-ta

Blogs/Twitter accounts about Clojure

2010-09-02 Thread HB
Hey, Would you please recommend some good Blogs/Twitter accounts about Clojure? Thanks. -- 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: RT vs recasting

2010-09-02 Thread Timothy Baldridge
Ah...so I looked into the RT code a bit more and you're right. If we passed in a Java array or a Java String then it would need to be converted to a Seqable class first then we could have a seq() method to call. Thanks, Timothy On Thu, Sep 2, 2010 at 9:43 AM, Armando Blancas wrote: > Probably s

union using a comparison function

2010-09-02 Thread mlimotte
Hi. I'd like to do a union of some sequences using my own comparison function. Similar to supplying a Comparator in Java. The things being compared are Objects from a Java library that I don't control, so I can't just override the equals function on the class, for example. Would aprecaite any s

Re: multiple parameters passed to fns

2010-09-02 Thread Justin Kramer
A couple other things: 1) (apply identity ...) is the same as (first ...) 2) Consider using the ->> macro to clean up the let Here's a quick rewrite: (defn make-target ([file channel sweepidx] (make-target file channel sweepidx 0)) ([file channel sweepidx startidx] (make-target file

Re: RT vs recasting

2010-09-02 Thread Armando Blancas
Probably so the list can be compared to anything and thus o may not implement Seqable, like: user=> (.equals '() nil) false On Sep 1, 4:14 pm, Timothy Baldridge wrote: > While examining the Clojure source I came across this line in the > EmptyList class: > >     public boolean equals(Object o) {

Re: Tutorial: clojure.zip

2010-09-02 Thread Mark Rathwell
Meant to thank you for this. It was very timely for me, and very understandable. On Thu, Sep 2, 2010 at 10:34 AM, Brian Marick wrote: > I've written a short tutorial for clojure.zip: > > > http://www.exampler.com/blog/2010/09/01/editing-trees-in-clojure-with-clojurezip/ > > - > Brian Marick

Tutorial: clojure.zip

2010-09-02 Thread Brian Marick
I've written a short tutorial for clojure.zip: http://www.exampler.com/blog/2010/09/01/editing-trees-in-clojure-with-clojurezip/ - Brian Marick, independent consultant Mostly on agile methods with a testing slant Author of /Programming Cocoa with Ruby/ www.exampler.com, www.exampler.com/blog,

Re: Extending Clojure's STM with external transactions

2010-09-02 Thread Timothy Baldridge
>It checks the value against memory. If it's >the same, commit data store changes. If not, retry after refreshing >memory with the current contents of the store. May I suggest we take a page from the CouchDB book here? In addition to having a "id" each ref also has a revision id. Let's say the i

Re: multiple parameters passed to fns

2010-09-02 Thread Miki
Hello Glen, I'd use the first two forms to set startidx and size and then call the "full" form: (def inf java.lang.Double/POSITIVE_INFINITY) (defn make-target "Parses text file for single sweep specified by sweepidx. If size is not specified will parse till end of sweep. If startidx and si

multiple parameters passed to fns

2010-09-02 Thread Glen Rubin
I defined a fn whose execution depends on the number of parameters passed to it. It works fine! I am just concerned that I am doing this in a way that is not as concise as it could or should be. Here is my fn: (defn make-target "Parses text file for single sweep specified by sweepidx. If size

Re: Extending Clojure's STM with external transactions

2010-09-02 Thread Linus Ericsson
Persistant variable handling is one of the things which I have spent much time on as a beginner and former SQL-illiterate (Among getting the swank to finally work (it's a dream!)). I have however got into databases quite a bit among the way - but it was not my main goal and it has taken some time f

Re: How to use Java array of primitive types as key of Clojure map?

2010-09-02 Thread John Fingerhut
Thanks! That worked for me. Understood on the precautions about these things not being immutable, and thus potentially unsafe as hash keys (and anything else that expects immutability, whether that is obvious or not). This raises the question in my mind -- will there be something in Clojure, per

Re: Clojure 1.2 and the Computer Language Benchmarks Game

2010-09-02 Thread John Fingerhut
Thanks to many people on this list in Aug 2009 who helped improve my code, to Johannes Friestad for writing a nice fast Clojure program using deftype for the n-body problem, to Isaac Gouy for setting up the shootout web site to accept Clojure submissions, and to my having more time than good sense

RT vs recasting

2010-09-02 Thread Timothy Baldridge
While examining the Clojure source I came across this line in the EmptyList class: public boolean equals(Object o) { return (o instanceof Sequential || o instanceof List) && RT.seq(o) == null; } What's up with the RT.seq(o) == null? Why don't we do this instead: public boolea

Re: Extending Clojure's STM with external transactions

2010-09-02 Thread Alyssa Kwan
I'll go one step further and say that we shouldn't have to call "persist namespace". It should be automatic such that a change to the state of an identity is transactionally written. Let's start with refs. We can tackle the other identities later. The API is simple. Call (refp) instead of (ref