Re: ANN: clojure-maven-plugin 1.0 released and in maven central

2009-08-24 Thread ngocdaothanh
I'm new to Maven. Thank you for the explanation. Using git-submodules and is a good idea. Prior to using your plugin, I use clojure and clojure-contrib with Maven like this: 1. Manually download from GitHub and compile clojure and clojure- contrib. 2. Install them to the local Maven repository:

Re: ANN: clojure-maven-plugin 1.0 released and in maven central

2009-08-24 Thread Mark Derricutt
The plugin itself has NO dependency on clojure or clojure contrib so you'll need to add them to your own pom.xml first. This is mostly because a) clojure contrib hasn't been released or in maven central, b) I'm using clojure 1.1 on my own projects which isn't released. For my own projects, I have

Re: How to generate a hash map from a list

2009-08-24 Thread Adrian Cuthbertson
> (defn fzipmap [f col] > "Takes a col, applies f to each element and generates a Note that the args should have come after the doc string! On Tue, Aug 25, 2009 at 6:20 AM, Adrian Cuthbertson wrote: > For completeness we should include a loop/recur pattern; > > (defn fzipmap [f col] >  "Takes a

Re: A little discovery: abbreviated-namespace-qualified keywords

2009-08-24 Thread Adrian Cuthbertson
Also just what I needed - thanks! On Mon, Aug 24, 2009 at 8:05 PM, Dragan Djuric wrote: > > It may look silly, but that's just what I need AND the last time I > checked > it didn't work! > Now it does :) > > Thanks! > >> On Aug 24, 7:14 pm, samppi wrote: >> I just discovered something cool that

Re: How to generate a hash map from a list

2009-08-24 Thread Adrian Cuthbertson
For completeness we should include a loop/recur pattern; (defn fzipmap [f col] "Takes a col, applies f to each element and generates a hash map keyed on each element of col." (loop [col (seq col) mp {}] (if col (recur (next col) (assoc mp (first col) (f (first col mp))) user=

Re: ANN: clojure-maven-plugin 1.0 released and in maven central

2009-08-24 Thread ngocdaothanh
Hi, Is clojure-contrib included? I tried but mvn clojure:compile gives: Exception in thread "main" java.io.FileNotFoundException: Could not locate clojure/contrib/json/read__init.class or clojure/contrib/json/ read.clj on classpath pom.xml: http://gist.github.com/174217 hello.clj: (ns hello) (

Re: proxy and annotation

2009-08-24 Thread Mark Derricutt
Currently clojure doesn't support annotations, which is a huge issue at times when integrating with some newer java frameworks. I'm not sure if anyones working on it yet either, and to be honest I'm not even sure what syntax would work well - something encoded in the metadata woud be good I guess.

Re: Continuous Integration Builds for Clojure are Back!

2009-08-24 Thread Mark Derricutt
I had created the plan, but couldn't clone any of the clojure plans ( I could clone others ). However, as the project is now pretty stable (I just released 1.0 in fact) a CI build isn't really needed any more. However I can't seem to find any links to delete the plan I created :( Mark -- On Mo

ANN: clojure-maven-plugin 1.0 released and in maven central

2009-08-24 Thread Mark Derricutt
Hey all, I've released 1.0 of my clojure-maven-plugin and its now available in maven-central. To use it, a minimal pom.xml declaring a dependency on clojure, and the the plugin (without configuration) is all you need. - http://gist.github.com/174217 With the above pom, running "mvn clojure:com

Re: vimclojure issues

2009-08-24 Thread Meikel Brandmeyer
Hi, Am 24.08.2009 um 21:37 schrieb Sang Ahn: I have the same issue even w/ the cursor directly above the 'd' character. Hmm... Do you have syntax highlighting turned on? Sincerely Meikel smime.p7s Description: S/MIME cryptographic signature

Re: vimclojure issues

2009-08-24 Thread Sang Ahn
I have the same issue even w/ the cursor directly above the 'd' character. On Mon, Aug 24, 2009 at 5:48 AM, Meikel Brandmeyer wrote: > > Hi, > > On Aug 24, 1:33 pm, Michael Wood wrote: > >> > I'm not sure, what you mean with "inside the first cursor". But my >> > suspicion is, that you place the

Re: Symbol to keyword

2009-08-24 Thread Meikel Brandmeyer
Hi, Am 24.08.2009 um 20:03 schrieb Laurent PETIT: Yes. The trick is that (keyword 'x/y) is different from (ns x) ::y ?? ::y is similar to `y. (Besides the resolving issue, which doesn't make sense for keywords...) For keyword there was some issue, that (keyword "foo/bar") creates a ke

Re: Symbol to keyword

2009-08-24 Thread Achim Passen
Hi! Am 24.08.2009 um 18:31 schrieb Dragan Djuric: > I needed (and created) a macro to generate keywords from symbols. I > couldn't find anything ready, and I am still not completely > comfortable with the solution I came up with. Any suggestions for > improvement? If I understand you correctly,

Re: Symbol to keyword

2009-08-24 Thread Konrad Hinsen
On 24 Aug 2009, at 19:55, Dragan Djuric wrote: > Yes. The trick is that > (keyword 'x/y) > is different from > (ns x) > ::y Not in my copy of Clojure: user=> (ns x) nil x=> ::y :x/y x=> (identical? ::y (keyword 'x/y)) true Konrad. --~--~-~--~~~---~--~~ You re

Re: A little discovery: abbreviated-namespace-qualified keywords

2009-08-24 Thread Dragan Djuric
It may look silly, but that's just what I need AND the last time I checked it didn't work! Now it does :) Thanks! > On Aug 24, 7:14 pm, samppi wrote: > I just discovered something cool that might seem obvious to some > people but is, as as I can tell, undocumented and caught me totally by > sur

Re: Symbol to keyword

2009-08-24 Thread Laurent PETIT
2009/8/24 Dragan Djuric > > Yes. The trick is that > (keyword 'x/y) > is different from > (ns x) > ::y ?? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojur

Re: Symbol to keyword

2009-08-24 Thread Dragan Djuric
Yes. The trick is that (keyword 'x/y) is different from (ns x) ::y On Aug 24, 7:07 pm, Konrad Hinsen wrote: > On 24 Aug 2009, at 18:31, Dragan Djuric wrote: > > > I needed (and created) a macro to generate keywords from symbols. I > > couldn't find anything ready, and I am still not completely >

A little discovery: abbreviated-namespace-qualified keywords

2009-08-24 Thread samppi
I just discovered something cool that might seem obvious to some people but is, as as I can tell, undocumented and caught me totally by surprise. It's well known that the reader resolves ::something into :the-current-namespace/something. But what I found out is that if you use require to alias a n

Re: How to generate a hash map from a list

2009-08-24 Thread samppi
Wonderful; I totally didn't know about zipmap. I've been using into and map this whole time. Was it added right before Clojure 1.0? It seems to be a lot faster than using into: Clojure 1.0.0- user=> (time (into {} (for [i [1 2 3]] [i (+ 3 i)])) ) "Elapsed time: 0.705 msecs" {3 6, 2 5, 1 4} user=>

Re: Symbol to keyword

2009-08-24 Thread Konrad Hinsen
On 24 Aug 2009, at 18:31, Dragan Djuric wrote: > I needed (and created) a macro to generate keywords from symbols. I > couldn't find anything ready, and I am still not completely > comfortable with the solution I came up with. Any suggestions for > improvement? What are your exact requirements?

Symbol to keyword

2009-08-24 Thread Dragan Djuric
Hi, I needed (and created) a macro to generate keywords from symbols. I couldn't find anything ready, and I am still not completely comfortable with the solution I came up with. Any suggestions for improvement? Here is what it should do: => (def name1 "A") => (to-keyword name1) :user/name1 => (n

Re: Newbie Eclipse REPL question

2009-08-24 Thread Laurent PETIT
Hello, 2009/8/23 Seth.Powsner > > Is there some simple way to spin-up the REPL and start stepping > through top-level expressions in a source file? > (I've probably missed something simple.) > > Background-- Eclipse 3.4.2 is running on my MacBook under OS 10.4.11. > Works fine for a little Java

Re: Weird namespace behavior when reloading code

2009-08-24 Thread Laurent PETIT
(require 'ns-a) will 'install' the namespace ns-a in the clojure environment. If ns-a has other namespaces that it requires ... they will also be installed for ns-a to be fully functional. (use 'ns-a) will not only 'install' the namespace ns-a, but also create mappings for all public vars of nam

Re: How to generate a hash map from a list

2009-08-24 Thread Dragan Djuric
(zipmap coll1 coll2) should be faster than (apply hash-map (interleave coll1 coll2)) and the doc description hints that's what it was made for. On Aug 24, 8:25 am, Garth Sheldon-Coulson wrote: > Welcome again. > > Here's another way. Not sure if it's any more or less efficient, but it's > the wa

Re: Weird namespace behavior when reloading code

2009-08-24 Thread CuppoJava
Laurent would you mind explaining what is the difference between require and use? I don't understand the documentation for those functions. Thanks a lot -Patrick --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cloj

Re: Annotations and gen-class

2009-08-24 Thread J. McConnell
On Mon, Aug 24, 2009 at 3:00 AM, ngocdaothanh wrote: > > I'm new to Clojure. How can I add @ChannelPipelineCoverage("one") > annotation to a proxy as in? > > http://viewvc.jboss.org/cgi-bin/viewvc.cgi/netty/trunk/src/main/java/org/jboss/netty/example/http/snoop/HttpResponseHandler.java?view=markup

Fwd: Annotations and gen-class

2009-08-24 Thread ngocdaothanh
Hi, I'm new to Clojure. How can I add @ChannelPipelineCoverage("one") annotation to a proxy as in? http://viewvc.jboss.org/cgi-bin/viewvc.cgi/netty/trunk/src/main/java/org/jboss/netty/example/http/snoop/HttpResponseHandler.java?view=markup I tried: (def handler (proxy [SimpleChannelUpstreamHan

Re: vimclojure issues

2009-08-24 Thread Meikel Brandmeyer
Hi, On Aug 24, 1:33 pm, Michael Wood wrote: > > I'm not sure, what you mean with "inside the first cursor". But my > > suspicion is, that you place the cursors *on* the '(' of the defn. > > This will not work. The cursor must be really *inside* the parens. Eg. > > on the 'o' of the `defn`. If t

Re: How to generate a hash map from a list

2009-08-24 Thread ztellman
On Aug 23, 5:21 pm, Stan Dyck wrote: > I'm still new to this so bear with me. > > I'm trying to apply a function to a seq-able thing to produce a hashmap. So > for instance say the function is (inc 3). > I'd like to write a function that does > > [1 2 3] --> {1 4, 2 5, 3 6} > > Can someone help

proxy and annotation

2009-08-24 Thread ngocdaothanh
Hi, How can I define annotation for a proxy? For example: Java code: http://viewvc.jboss.org/cgi-bin/viewvc.cgi/netty/trunk/src/main/java/org/jboss/netty/example/http/snoop/HttpResponseHandler.java?view=markup Clojure code: (def handler (proxy [SimpleChannelUpstreamHandler] [] (message

Re: How to generate a hash map from a list

2009-08-24 Thread Garth Sheldon-Coulson
Welcome again. Here's another way. Not sure if it's any more or less efficient, but it's the way my brain works. => (defn map-hashmap [coll f] (apply hash-map (interleave coll (map f coll #'user/map-hashmap => (map-hashmap [1 2 3] #(+ % 3)) {1 4, 2 5, 3 6} On Mon, Aug 24, 2009 at 2:1

Re: vimclojure issues

2009-08-24 Thread Michael Wood
2009/8/24 Meikel Brandmeyer : > > Hi, > > On Aug 22, 11:43 pm, Sang Ahn wrote: > >> I am having trouble sending expressions to repll. >> If I have (defn greet [] (println "Hello")), I position the cursor to >> be inside the first cursor, then type \et, and I get the message, >> "Error: Not in top

Re: vimclojure issues

2009-08-24 Thread Meikel Brandmeyer
Hi, On Aug 22, 11:43 pm, Sang Ahn wrote: > I am having trouble sending expressions to repll. > If I have (defn greet [] (println "Hello")), I position the cursor to > be inside the first cursor, then type \et, and I get the message, > "Error: Not in toplevel expression!" > What gives? I'm not

Re: How to generate a hash map from a list

2009-08-24 Thread Timothy Pratley
(def a [1 2 3]) ; zipmap takes two collections and makes a hash-map user=> (zipmap a (map #(+ 3 %) a)) {3 6, 2 5, 1 4} ; another way is to build up a map starting with empty {} and associating key values user=> (reduce #(assoc %1 %2 (+ 3 %2)) {} a) {3 6, 2 5, 1 4} ; hash-map constructs a map fo