Re: updating a map value

2011-03-31 Thread Jozef Wagner
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 ros...@gmail.com wrote: Hola, I'm looking for a function that updates a map value by calling a function on it. (def foo {:a 1}) So instead of this: (assoc

Re: updating a map value

2011-03-31 Thread Alan
On Mar 30, 11:29 pm, Jozef Wagner jozef.wag...@gmail.com 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 ros...@gmail.com wrote: Hola,   I'm looking for a function that updates a map value by calling a

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

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 snip (:import

Re: map function

2011-03-31 Thread Meikel Brandmeyer
Hi, On 31 Mrz., 10:35, Vincent vincent@gmail.com 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

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: 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: servlet

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 akjohnso...@gmail.com 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

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

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:

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

Re: Basic compilation question

2011-03-31 Thread Meikel Brandmeyer
Hi, On 31 Mrz., 13:20, MohanR radhakrishnan.mo...@gmail.com 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

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 #CompilerException java.lang.ClassNotFoundException: org.apache.commons.cli.Parser user= (import (java.io File) (java.net URL

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 vit...@ufairsoft.comwrote: Wanted to add jar to classpath without restarting REPL.

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 Laurent PETIT
There is this which is in Clojure, but is considered deprecated : clojure.core/add-classpath 2011/3/31 Vitaly Peressada vit...@ufairsoft.com Wanted to add jar to classpath without restarting REPL. Recalled java reflection hack. Ported to Clojure. user= (import (org.apache.commons.cli

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

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 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,

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

2011-03-31 Thread Laurent PETIT
2011/3/31 Ken Wesson kwess...@gmail.com 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 memoizes for vars you do no own if their author didn't make their holding var :dynamic ('cause

Re: Clojure Interop With Java Using Eclipse.

2011-03-31 Thread Laurent PETIT
2011/3/31 Armando Blancas armando_blan...@yahoo.com 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.

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

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

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

Re: Clojure Interop With Java Using Eclipse.

2011-03-31 Thread Laurent PETIT
2011/3/31 Armando Blancas armando_blan...@yahoo.com 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

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 laurent.pe...@gmail.com wrote: 2011/3/31 Ken Wesson kwess...@gmail.com 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 memoizes for vars

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.

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

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

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.