Re: Emacs with Lisp and Clojure.

2011-03-24 Thread Tassilo Horn
mmwaikar writes: > But the same enter key works properly when I am using Lisp, so why > shouldn't it be the default in Clojure as well? What's considered "properly" for RET is purely subjective. :-) But I have to admit that I was wrong. When paredit-mode is enabled, RET is indeed bound to `par

Re: gen-class and state...

2011-03-24 Thread Jules
Guys, Thanks for your replies - I'm glad I posted as this is exactly what I was looking for. I wish I had found Stuart's article when he wrote it. I had an inkling that my gen-class struggles were out of date - now I can go and rework all that code :-) Problem solved. Thanks again, Jules --

Re: gen-class and state...

2011-03-24 Thread Ulises
Sorry for hijacking but I wouldn't mind some clarification on the subject. Right now I can get java classes and interfaces with defprotocol and defrecord and the world is good. Can somebody please educate me in the uses/needs for :gen-class and friends? Keep in mind that I haven't really done mu

Re: gen-class and state...

2011-03-24 Thread Meikel Brandmeyer
Hi, On 24 Mrz., 10:40, Ulises wrote: > Can somebody please educate me in the uses/needs for :gen-class and friends? You need gen-class when you want (or have to) derive from another class. defrecord/deftype/reify don't allow that, while gen-class/proxy do. Sincerely Meikel -- You received th

Re: gen-class and state...

2011-03-24 Thread Ulises
> You need gen-class when you want (or have to) derive from another > class. defrecord/deftype/reify don't allow that, while gen-class/proxy > do. I suppose this is for when you want to add fields to an already existing class? (I'm assuming that adding methods could be done with extend/extend-prot

http://build.clojure.org/releases - no alpha5 alpha6.. ?

2011-03-24 Thread Jules
is this: http://build.clojure.org/releases/org/clojure/clojure/ no longer the place to point my maven :-( I'd love to give the latest alpha's a try, but the thought of manually d/l-ing them and then installing them into my local repo is just too much !! should I point somewhere else, or will t

Re: Jesus, how the heck to do anything?

2011-03-24 Thread Matthias Diehn Ingesman
Hi, You can write some lines of Clojure code in a file, and then execute it with the command 'clj '. I'm sitting on a linux box where the script to start Clojure is called 'clj', but if you don't have such or simply downloaded the zip from clojure.org, you can use this line to execute a script cal

Java Interop - Generics - Hmmm...

2011-03-24 Thread Jules
Guys, I have a hybrid Java/Clojure project. The Java side contains a number of interfaces/classes that make use of generics. Implementing the interfaces Clojure-side is no problem - I just forget about type and get on with it :-) I am slowly migrating more and more code into Clojure and there

Re: Jesus, how the heck to do anything?

2011-03-24 Thread Baishampayan Ghose
On Thu, Mar 24, 2011 at 8:34 AM, ultranewb wrote: >> That's quite alright. Nine out of ten people here hate java; > > Actually, I didn't know that.  I imagined that 9 out of 10 people here > would be java-ites.  It's good to know that I'm in good company. Clojure won't have existed if the people

Re: Jesus, how the heck to do anything?

2011-03-24 Thread ultranewb
On Mar 24, 10:19 am, Sean Corfield wrote: > Heh, even as a long-time Java developer (since '97), I'm here because > I want something _better_ than Java. It's why I learned Groovy in 2008 > (sort of "Java-lite" - fixes most of Java's problems but suffers from > performance issues compared to Java),

Re: Extra params for a handler inside Ring's wrap-params

2011-03-24 Thread Thorsten Wilms
On 03/23/2011 02:32 PM, Thorsten Wilms wrote: Hi! Routing, using ring.middleware.params and net.cgrand.moustache: (def tlog-app-handler (app ["admin" &] {:get (app ...snip...) :post (app wrap-params [[path not-empty] &] submit-article)} Thanks to wrap-params, I can destructure request

Re: Jesus, how the heck to do anything?

2011-03-24 Thread Meikel Brandmeyer
Hi, On 24 Mrz., 13:09, Baishampayan Ghose wrote: > Clojure won't have existed if the people here were satisfied with Java. I think, there is a difference between "hate" and "dissatisfaction." IMHO the Java bashing is overrated. Coming from a polyglot-but-non- java background, I didn't have muc

Re: Jesus, how the heck to do anything?

2011-03-24 Thread Timothy Baldridge
> I didn't have much trouble getting things running. Is > the CLASSPATH really so much different to the PYTHONPATH, > LD_LIBRARY_PATH or even the plain old PATH itself? No, it's not that much different, except python is a bit more smart about how things are setup. For instance, if you startup scri

Re: Jesus, how the heck to do anything?

2011-03-24 Thread Baishampayan Ghose
On Thu, Mar 24, 2011 at 6:52 PM, Meikel Brandmeyer wrote: >> Clojure won't have existed if the people here were satisfied with Java. > > I think, there is a difference between "hate" and "dissatisfaction." I agree. That's precisely why I used the word "satisfied" and not any variation of love/hat

Re: Java Interop - Generics - Hmmm...

2011-03-24 Thread Armando Blancas
For interop I write interfaces in Java. This way I can provide type- specific signatures, constants, javadocs and generics; then implement them all in Clojure. I also write exception classes in Java for use in Clojure since I find it simpler and cleaner than gen-class. You don't have to give up any

Re: http://build.clojure.org/releases - no alpha5 alpha6.. ?

2011-03-24 Thread Andy Fingerhut
I've been using a project.clj file like this in Leiningen to get 1.3 alpha1 through alpha6: (defproject clj-1.3.0-alpha5 "1.0.0-SNAPSHOT" :description "FIXME: write" :dependencies [[org.clojure/clojure "1.3.0-alpha5"]]) Leiningen uses Maven under the hood, so if you have any Maven pom.xml fi

Re: Java Interop - Generics - Hmmm...

2011-03-24 Thread Jules
Thanks for the reply Armando, This is pretty much where i was until I was asked to write a dot.net client library for my server. I then looked at all my Java code and figured I could write a second copy in C# and then keep the two in sync for ever after, or port it all to Clojure and let Cloju

RabbitMQ

2011-03-24 Thread Max Weber
What is the best Clojure library to work with RabbitMQ? Best regards Max -- 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 - please be patient

Implicit unpacking of a map

2011-03-24 Thread Thorsten Wilms
Hi! The following simplified code works: (defn save-article [path form-params timestamp] (ds/save! (Article. path (form-params "title") (form-params "body") timestamp But I would like to not handle the content of form-params explicitly. My naive attempt that shows that I

Re: Java Interop - Generics - Hmmm...

2011-03-24 Thread Andy Fingerhut
I'm not an expert on this, but I believe that whenever you have generics in Java, they have no effect on the bytecode, e.g. a HashMap has the same type in the bytecode as any other HashMap. The part is only used in some checks made by the Java compiler when compiling Java source code, and in

Re: http://build.clojure.org/releases - no alpha5 alpha6.. ?

2011-03-24 Thread Jules
Aha ! OK - so maven is pulling alpha5/6 in from somewhere, but not from the repo that I expected - and unfortunately, I am not finding clojure.contrib.logging for these releases - maybe contrib is not being released to the same repo ? or maybe it has changed its name ? I'll have to investigate

Re: RabbitMQ

2011-03-24 Thread Mark Rathwell
I just wrapped their java client library: http://www.rabbitmq.com/java-client.html On Thu, Mar 24, 2011 at 11:15 AM, Max Weber wrote: > What is the best Clojure library to work with RabbitMQ? > > Best regards > > Max > > -- > You received this message

Re: http://build.clojure.org/releases - no alpha5 alpha6.. ?

2011-03-24 Thread Chas Emerick
Jules, All new Clojure artifacts are being released to maven central now, which is always checked by maven (and therefore lein): http://mavencentral.sonatype.com/#search|ga|1|org.clojure I think all existing prior releases of Clojure and clojure-contrib are there now as well. Unless you're lo

Re: Implicit unpacking of a map

2011-03-24 Thread Tassilo Horn
Thorsten Wilms writes: Hi Thorsten, > The following simplified code works: > > (defn save-article > [path form-params timestamp] > (ds/save! (Article. path (form-params "title") (form-params "body") > timestamp > > > But I would like to not handle the content of form-param

Re: Implicit unpacking of a map

2011-03-24 Thread Meikel Brandmeyer
Hi, On 24 Mrz., 16:16, Thorsten Wilms wrote: > > (defn save-article >    [path form-params timestamp] >    (ds/save! (Article. path (form-params "title") (form-params "body") >       timestamp > The problem is the constructor call. With plain old clojure functions you could use ap

Re: Java Interop - Generics - Hmmm...

2011-03-24 Thread Alessio Stalla
On Thursday, March 24, 2011 5:29:56 PM UTC+1, Jules wrote: > > Thanks Andy, > > I agree that there is no practical remnant of generics in the runtime as I > have poked around with reflection as well, but I think there might be in the > bytecode, otherwise if I compiled a generic interface, stuck

Re: Java Interop - Generics - Hmmm...

2011-03-24 Thread Alan
This is only half-true. The data exists somewhere, as Jules says, so that javac can enforce proper use of generics when calling compiled library code. Eg, rt.jar contains only classes, yet j.u.List still manages to have generics, which are treated correctly by the compiler. The *use* of generic cod

Re: Java Interop - Generics - Hmmm...

2011-03-24 Thread Jules
Thanks Andy, I agree that there is no practical remnant of generics in the runtime as I have poked around with reflection as well, but I think there might be in the bytecode, otherwise if I compiled a generic interface, stuck it into a jar and gave it to you to link against, the compiler would

Re: http://build.clojure.org/releases - no alpha5 alpha6.. ?

2011-03-24 Thread Jules
Aha! Thanks. Looking at the link you have posted the latest version of Clojure is alpha6, but contrib is reporting 1.2 - that must be the root of my problem. i have been using http://build.clojure.org/releases/org/clojure/clojure/because up until alpha4 it was serving both in sync. Do you know

Re: Java Interop - Generics - Hmmm...

2011-03-24 Thread Alan
On Mar 24, 9:47 am, Alessio Stalla wrote: > Reflection is aware of generic type > variables:http://download.oracle.com/javase/6/docs/api/java/lang/reflect/Generi... > > What is lost at runtime is information about *instantiation* of those > variables: e.g. you can't distinguish a method returning

Re: gen-class and state...

2011-03-24 Thread Jules
Stuart, I still think in a very OO way - which is probably why I am having difficulty with this :-) A common OO pattern is to encapsulate complex resource acquisition/release within a class. I can do this with gen-class - since I control ctor args and the instances initial state, as well as h

Re: http://build.clojure.org/releases - no alpha5 alpha6.. ?

2011-03-24 Thread Andy Fingerhut
There was a recent discussion on clojure-dev about this question. I don't understand the details myself, so I'll point you at the thread. The relevant part starts about 2/3 of the way through this 51-message thread, around March 19, between Sean Corfield and Stuart Sierra (sorry, I don't know

Re: Java Interop - Generics - Hmmm...

2011-03-24 Thread Jules
cool :-) I had a feeling that there was some vestige of generics left at runtime - now I know exactly what it is. thanks guys, Jules -- 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

Re: Emacs with Lisp and Clojure.

2011-03-24 Thread MarisO
swank-clojure is deprecated, don't use it. Instead start swank from leiningen. I found these instructions how to install clojure support in emacs http://riddell.us/ClojureSwankLeiningenWithEmacsOnLinux.html No need to use elpa with broken packages or starter-kit. Maris On Mar 24, 8:14 am, Tass

Re: RabbitMQ

2011-03-24 Thread Alex Robbins
According to http://www.clojure-toolbox.com/ https://github.com/mefesto/wabbitmq But I'm pretty new to clojure and don't know if it is good. On Thu, Mar 24, 2011 at 10:30 AM, Mark Rathwell wrote: > > I just wrapped their java client library: > http://www.rabbitmq.com/java-client.html > > On Thu

Re: RabbitMQ

2011-03-24 Thread Dennis
We did the same On Thu, Mar 24, 2011 at 10:30 AM, Mark Rathwell wrote: > > I just wrapped their java client library: > http://www.rabbitmq.com/java-client.html > > On Thu, Mar 24, 2011 at 11:15 AM, Max Weber > wrote: >> >> What is the best Clojure library to work with RabbitMQ? >> >> Best regard

Re: Java Interop - Generics - Hmmm...

2011-03-24 Thread Alessio Stalla
On 24 Mar, 17:54, Alan wrote: > On Mar 24, 9:47 am, Alessio Stalla wrote: > > > Reflection is aware of generic type > > variables:http://download.oracle.com/javase/6/docs/api/java/lang/reflect/Generi... > > > What is lost at runtime is information about *instantiation* of those > > variables: e.

Re: Implicit unpacking of a map

2011-03-24 Thread Thorsten Wilms
On 03/24/2011 05:40 PM, Meikel Brandmeyer wrote: The problem is the constructor call. With plain old clojure functions you could use apply, but Java method and constructor calls must be hard-wired in the bytecode (and hence at compilation time) (if I understood this correctly). Guess that's wh

Re: Implicit unpacking of a map

2011-03-24 Thread Alan
A macro should work fine if you use ~@ instead of just ~. (defmacro save-article [path form-params timestamp] `(ds/save! (Article. ~path ~@(vals form-params) ~timestamp))) On Mar 24, 1:28 pm, Thorsten Wilms wrote: > On 03/24/2011 05:40 PM, Meikel Brandmeyer wrote: > > > The problem is the

Re: http://build.clojure.org/releases - no alpha5 alpha6.. ?

2011-03-24 Thread Stuart Sierra
Short summary: Clojure 1.3.0-alpha5 and -alpha6 have been released to Maven Central, which is the default repo for all Maven-based tools, including Leiningen. "New" clojure-contrib libraries are also being released to Maven Central. See http://dev.clojure.org/display/design/Contrib+Projects fo

Re: gen-class and state...

2011-03-24 Thread Stuart Sierra
A typical pattern for resource management is a function or macro like `with-open-file`. -S -- 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

Re: Implicit unpacking of a map

2011-03-24 Thread Meikel Brandmeyer
Hi, Am 24.03.2011 um 21:38 schrieb Alan: > A macro should work fine if you use ~@ instead of just ~. > > (defmacro save-article > [path form-params timestamp] > `(ds/save! (Article. ~path ~@(vals form-params) ~timestamp))) A macro works only with literal maps. Sincerely Meikel -- You rec

Re: Implicit unpacking of a map

2011-03-24 Thread Alan
I find it easier to write web apps if my users provide me with their inputs at compile time anyway. On Mar 24, 1:45 pm, Meikel Brandmeyer wrote: > Hi, > > Am 24.03.2011 um 21:38 schrieb Alan: > > > A macro should work fine if you use ~@ instead of just ~. > > > (defmacro save-article > >   [path

Re: Implicit unpacking of a map

2011-03-24 Thread Thorsten Wilms
On 03/24/2011 09:38 PM, Alan wrote: A macro should work fine if you use ~@ instead of just ~. (defmacro save-article [path form-params timestamp] `(ds/save! (Article. ~path ~@(vals form-params) ~timestamp))) Thanks for the suggestion, but: Unknown location: error: java.lang.Illega

Re: Implicit unpacking of a map

2011-03-24 Thread Ken Wesson
What about this? First, use :title and :body keywords instead of "title" and "body" strings as keys in form-params. Then define this utility function: (defn get-seq [m & kws] ((apply juxt kws) m)) which takes a map and one or more keywords (cannot be other types of key) and returns a seq (actua

Re: http://build.clojure.org/releases - no alpha5 alpha6.. ?

2011-03-24 Thread Sean Corfield
Yeah, the confusion around what's where led me to create this dynamic page on my site: http://corfield.org/clj/index.cfm As pointed out on clojure-dev, yes, you can use the Maven search for "clojure" but that didn't get me what I really wanted. Hopefully that page is useful to others... On Thu,

Re: Jesus, how the heck to do anything?

2011-03-24 Thread Sean Corfield
On Thu, Mar 24, 2011 at 3:37 AM, ultranewb wrote: > Since we are mentioning other languages (I'm sure it's a little off- > topic, but what the hey), if you really want to fry your brain and > blow your mind, check out APL, or its modern successor, J. My final year project at university was to wri

Re: http://build.clojure.org/releases - no alpha5 alpha6.. ?

2011-03-24 Thread Aaron Bedra
On 03/24/2011 11:13 AM, Jules wrote: Aha ! OK - so maven is pulling alpha5/6 in from somewhere, but not from the repo that I expected - and unfortunately, I am not finding clojure.contrib.logging for these releases - maybe contrib is not being released to the same repo ? or maybe it has chang

Re: Jesus, how the heck to do anything?

2011-03-24 Thread ultranewb
On Mar 25, 8:58 am, Sean Corfield wrote: > My final year project at university was to write an APL interpreter > (in Pascal, back in '83). APL is a fun language. I haven't looked at J > (yet). Awesome! J is APL, but totally "modernized." Everything you would expect in a functional language (cur

Re: RabbitMQ

2011-03-24 Thread isaac praveen
On Thu, Mar 24, 2011 at 8:45 PM, Max Weber wrote: > What is the best Clojure library to work with RabbitMQ? > Give bunny a try. Might not be the best rabbitmq-client library :) https://github.com/icylisper/bunny example: (use 'bunny.publisher) (with-mq conn (publish "This is a message")) w

Re: Jesus, how the heck to do anything?

2011-03-24 Thread Ken Wesson
On Fri, Mar 25, 2011 at 12:36 AM, ultranewb wrote: > On Mar 25, 8:58 am, Sean Corfield wrote: >> My final year project at university was to write an APL interpreter >> (in Pascal, back in '83). APL is a fun language. I haven't looked at J >> (yet). > > Awesome! > > J is APL, but totally "moderniz