Re: Basic compilation question

2011-03-31 Thread MohanR
The correct syntax works. So basically if the swank-clojure-classpath has the required jar I should be able to import it in this way. The classpath seems to be tripping me up again. Thanks, Mohan On Mar 31, 5:12 pm, Meikel Brandmeyer wrote: > Hi, > > On 31 Mrz., 13:20, MohanR wrote: > > > (imp

Re: NB/Enclojure issues

2011-03-31 Thread Laurent PETIT
You should really consider adding a ;tldr section in your posts ... 2011/4/1 Ken Wesson > (I'm aware that there's a separate Enclojure Google Group but it seems > to get very little traffic, and I've seen similar issues to mine > raised there for literally years without seeing an answer posted >

Re: (memoize) and recursive functions (Clojure 1.2)

2011-03-31 Thread Laurent PETIT
2011/4/1 Ken Wesson > On Thu, Mar 31, 2011 at 3:24 PM, Laurent PETIT > wrote: > > 2011/3/31 Ken Wesson > >> > >> On Wed, Mar 30, 2011 at 12:02 PM, Laurent PETIT < > laurent.pe...@gmail.com> > >> wrote: > >> > Except in 1.3 it will be a little bit harder to do "throw-away" > >> > per-thread > >>

Re: ANN: Clojure wrappers for Liquibase and Spring-JDBC

2011-03-31 Thread Shantanu Kumar
Brief update: I have pushed 0.2 versions of both Clj-Liquibase (with pre-conditions support) and Fountain-JDBC (with predicate-based and rule-based transaction support) to Clojars. This brings Fountain-JDBC at par with c.c.sql and brings in some of Spring goodness. http://code.google.com/p/bitume

NB/Enclojure issues

2011-03-31 Thread Ken Wesson
(I'm aware that there's a separate Enclojure Google Group but it seems to get very little traffic, and I've seen similar issues to mine raised there for literally years without seeing an answer posted there, so I'm asking here.) While Enclojure provides a decent REPL and generally decent editing U

ANN: status-codes keyword status codes for compojure

2011-03-31 Thread Hubert Iwaniuk
status-codes allows you to report HTTP Response Status Codes as keywords like :ok, :accepted and so on. You can find code at github http://github.com/neotyk/status-codes (use 'status-codes) (GET "/test" _ :accepted) ;; or (PUT "/test" _ {:headers {"Location" ..} :status :created}) Enjoy, Hubert

1.3 master commit for lazy defn loading

2011-03-31 Thread Feng
Hello, Is this code valid? Clojure 1.3.0-master-SNAPSHOT user=> (let [] (defn foo [] :foo)) #'user/foo user=> (foo) ClassNotFoundException user$eval1450$foo__1451 java.lang.Class.forName0 (Class.java:-2) It was valid before this commit. https://github.com/clojure/clojure/commit/71930b6b6537a7

Re: (memoize) and recursive functions (Clojure 1.2)

2011-03-31 Thread Ken Wesson
On Thu, Mar 31, 2011 at 3:24 PM, Laurent PETIT wrote: > 2011/3/31 Ken Wesson >> >> On Wed, Mar 30, 2011 at 12:02 PM, Laurent PETIT >> wrote: >> > Except in 1.3 it will be a little bit harder to do "throw-away" >> > per-thread >> > memoizes for vars you do no "own" if their author didn't make the

Re: Clojure Interop With Java Using Eclipse.

2011-03-31 Thread Laurent PETIT
2011/3/31 Armando Blancas > > So, really, all the current ccw behaviour wrt auto-compile, in background > or > > not, concept of "Clojure Application" will be reworked. > > One thing that ccw handles with ease is compiling Java for use right > there in Clojure. With auto-compile one could do the

Re: Clojure Interop With Java Using Eclipse.

2011-03-31 Thread Armando Blancas
> So, really, all the current ccw behaviour wrt auto-compile, in background or > not, concept of "Clojure Application" will be reworked. One thing that ccw handles with ease is compiling Java for use right there in Clojure. With auto-compile one could do the opposite just as easy for dependent pro

Re: Pointer errors?

2011-03-31 Thread Stuart Halloway
> This is just *strange*. I'm working on converting a servlet that has > hardwired vectors of values to read those values from a > database. Given that this is simple, I'm using clojure.contrib.sql and > an sqlite plugin. Those vectors get walked in the init code to create > the hashmap that drives

Pointer errors?

2011-03-31 Thread Mike Meyer
This is just *strange*. I'm working on converting a servlet that has hardwired vectors of values to read those values from a database. Given that this is simple, I'm using clojure.contrib.sql and an sqlite plugin. Those vectors get walked in the init code to create the hashmap that drives page rend

Re: Clojure Interop With Java Using Eclipse.

2011-03-31 Thread Laurent PETIT
2011/3/31 Armando Blancas > > Your problem is probably that you only export the clj file. But the clj > file > > corresponds to a namespace with a gen-class. A gen-class must be > compiled. > > And yours is probably not. > > I'd think that's what the ccw.builder is there for. More or less. What

Re: (memoize) and recursive functions (Clojure 1.2)

2011-03-31 Thread Laurent PETIT
2011/3/31 Ken Wesson > On Wed, Mar 30, 2011 at 12:02 PM, Laurent PETIT > wrote: > > Except in 1.3 it will be a little bit harder to do "throw-away" > per-thread > > memoizes for vars you do no "own" if their author didn't make their > holding > > var :dynamic ('cause then you will not be able to

Re: Basic compilation question

2011-03-31 Thread Alan
You don't actually need to quote class names: (import com.test.Test) works. Of course if you're using the list syntax you do, to avoid calling the package as a function; but you can get around that as well by using a vector if you'd rather not quote: (import [com.test Test OtherTest]) On Mar 31, 5

Re: Clojure Interop With Java Using Eclipse.

2011-03-31 Thread Armando Blancas
> Your problem is probably that you only export the clj file. But the clj file > corresponds to a namespace with a gen-class. A gen-class must be compiled. > And yours is probably not. I'd think that's what the ccw.builder is there for. Then it'd be up to the user to decide what to export. Having

Generating Javadoc for Protocols gen-classes etc.

2011-03-31 Thread Dragan Djuric
Hi guys, How do you create Javadoc for the interfaces created from clojure Protocols or classes created using gen-class? -- 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 fro

Re: Adding jar to classpath in REPL

2011-03-31 Thread Vitaly Peressada
Thanks Laurent and Isaac for pointers. It would be interesting to know why clojure.core/add-classpath has been deprecated in 1.1? -- 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 p

Re: Adding jar to classpath in REPL

2011-03-31 Thread isaac praveen
On Thu, Mar 31, 2011 at 5:49 PM, Vitaly Peressada wrote: > Wanted to add jar to classpath without restarting REPL. Recalled java > reflection hack. Ported to Clojure. > Have a look at http://icylisper.in/jark/classpath.html Jark is a tool to manage classpaths and clojure namespaces on a persistent

Re: using clojure for (java) code generation; advice sought

2011-03-31 Thread Jules
I haven't had time to digest this whole thread and this solution is a bit off the wall... but do you really have a requirement to generate Java source ? Would Java bytecode not suffice ? If you were generating classes/interfaces you could ignore all the issues with Java syntax and just write a

Re: Adding jar to classpath in REPL

2011-03-31 Thread Laurent PETIT
There is this which is in Clojure, but is considered deprecated : clojure.core/add-classpath 2011/3/31 Vitaly Peressada > Wanted to add jar to classpath without restarting REPL. Recalled java > reflection hack. Ported to Clojure. > > user=> (import (org.apache.commons.cli Parser)) > ; fails with

Re: Clojure Interop With Java Using Eclipse.

2011-03-31 Thread Laurent PETIT
Hi, Your problem is probably that you only export the clj file. But the clj file corresponds to a namespace with a gen-class. A gen-class must be compiled. And yours is probably not. The more I use clojure with java interop, the less I'm tempted to play with gen-class when I'm not forced to. Why

Re: Adding jar to classpath in REPL

2011-03-31 Thread Ambrose B
One alternative to this would be to start a Nailgun server. You can add to the classpath quite easily. That said, this looks pretty interesting. Ambrose On Thu, Mar 31, 2011 at 8:19 PM, Vitaly Peressada wrote: > Wanted to add jar to classpath without restarting REPL. Recalled java > reflection

Adding jar to classpath in REPL

2011-03-31 Thread Vitaly Peressada
Wanted to add jar to classpath without restarting REPL. Recalled java reflection hack. Ported to Clojure. user=> (import (org.apache.commons.cli Parser)) ; fails with "# (import (java.io File) (java.net URL URLClassLoader) (java.lang.reflect Method)) (defn add-to-cp [#^String jarpath] (let

Re: Basic compilation question

2011-03-31 Thread Meikel Brandmeyer
Hi, On 31 Mrz., 13:20, MohanR wrote: > (import '(com.test.Test)) The correct syntax is (import 'com.test.Test) or (import '(com.test Test)). Note the subtle difference. Sincerely Meikel -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to t

Re: Clojure Interop With Java Using Eclipse.

2011-03-31 Thread Ulises
This has worked for me. Modify depending on your case. CAVEAT: I built a fatjar using $ lein uberjar which I then added as an external dependency in Eclipse. This included the clojure jar, the contrib and potentially lots of other stuff I had in my project. It is not entirely clear to me if one ne

Clojure Interop With Java Using Eclipse.

2011-03-31 Thread Christian
I've posted this question on StackOverflow: http://stackoverflow.com/questions/5452665/how-to-call-clojure-code-from-java It's still not working. I thought a crowd focused on Clojure may be able to help me out. Here's what I've done so far. I have used the example code from this answer: http://st

Basic compilation question

2011-03-31 Thread MohanR
I am using Clojurebox. If I import a Java class like this (import '(com.test.Test)) then C-c C-l ( JIT compilation ) does not work because this statement (let [t (Test/test "Test")]) throws java.lang.Exception: No such namespace: Test (core.clj:23) I should be able to use this non-AOT compilat

Re: Init timing for ring web servlet running on Jetty?

2011-03-31 Thread Mike Meyer
On Thu, 31 Mar 2011 06:55:08 -0400 Allen Johnson wrote: > > Is there some way to convince Jetty (or tomcat, or ...) to run the > > init methods of a servlet before the first request comes in? Or maybe > > a pointer to the appropriate forum? > > You can tell a servlet to init on startup with some

Re: Init timing for ring web servlet running on Jetty?

2011-03-31 Thread Allen Johnson
> Is there some way to convince Jetty (or tomcat, or ...) to run the > init methods of a servlet before the first request comes in? Or maybe > a pointer to the appropriate forum? You can tell a servlet to init on startup with something like this in your web.xml: test-servlet myapp.servlet

Init timing for ring web servlet running on Jetty?

2011-03-31 Thread Mike Meyer
I finally got back to the web app that needed init'ing before processing requests, and got that working (not quite as straightforward as the various mails/docs make it look). The problem now is that the init runs when the first request comes in after the app has been started. While this works, it

Re: map function

2011-03-31 Thread Meikel Brandmeyer
Hi, On 31 Mrz., 10:35, Vincent wrote: > (map keyword (map :tag vector-of-map))   (map (comp keyword :tag) vector-of-map) or (map #(-> % :tag keyword) vector-of-map) or (for [{:keys [tag]} vector-of-map] (keyword tag)) Sincerely Meikel -- You received this message because you are subscrib

Appengine-magic and Text properties

2011-03-31 Thread Thorsten Wilms
Hi! I'm using Clojure 1.2.0, Moustache 1.0.0-SNAPSHOT and Appengine-magic 0.4.0. My Article entity has a "body" property for text. The default String property doesn't handle long text, so it needs to be a Text property. In https://github.com/thurn/ackbar, I found: --- (ns (:import (com.

map function

2011-03-31 Thread Vincent
Dear all , can this be made better (map keyword (map :tag vector-of-map)) thanks in advance vincent -- 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

Re: updating a map value

2011-03-31 Thread Alan
On Mar 30, 11:29 pm, Jozef Wagner wrote: > On Wednesday, March 30, 2011 7:29:42 PM UTC+2, Mike Meyer wrote: > > > On Wed, 30 Mar 2011 10:21:41 -0700 (PDT) > > Jeff Rose wrote: > > > > Hola, > > >   I'm looking for a function that updates a map value by calling a > > > function on it. > > > > (def