Re: State of Clojure web development

2010-06-24 Thread Meikel Brandmeyer
Hi, On Jun 23, 11:23 pm, James Reeves weavejes...@googlemail.com wrote: 1. Have you written, or are you writing, a web application that uses Clojure? What does it do? I'm guerilla coding a small web app to do some very non-standard statistical analysis of customer returns (ABS/ESC systems for

faster json extraction?

2010-06-24 Thread braver
While writing JSON is fast, reading it back into a Clojure map is slow; even with clj-json, based on Jackson. Here's an idea: use Jackson's ObjectMapper. The following line extracts a Java Map: MapString,Object userData = mapper.readValue(new File(user.json), Map.class) (from

Re: STM style disk persistance

2010-06-24 Thread Laurent PETIT
Hi, What are the use cases you have in mind ? 2010/6/23 Timothy Baldridge tbaldri...@gmail.com: I'm wondering if we're going about this slightly the wrong way. Let's take a look at CouchDB. CouchDB prefers to keep all data on the disk at all times. As docs (or items) are added to a database

Re: State of Clojure web development

2010-06-24 Thread Adrian Cuthbertson
1. Have you written, or are you writing, a web application that uses Clojure? What does it do? I am and have been extending an existing production java web application environment with all new server work now being done in clojure. It is a complex jvm server running tomcat and other threaded

Re: clojure.contrib.logging in side-effect free functions?

2010-06-24 Thread ka
To my naive inexperienced eyes, there doesn't seem to be something obviously wrong with your code. Since FOR returns a lazy sequence of the results, is this function safe? (Seeing that it is not side-effect free?) I'm not getting this, do you foresee any safety issues? I think that the logs

Re: clojure.contrib.logging in side-effect free functions?

2010-06-24 Thread Laurent PETIT
Hi, 2010/6/17 William Wadsworth will.wadsworth...@gmail.com: Hi. I have just started learning Clojure and I am really enjoying myself. However, I am still getting to grips with the workings of its concurrency model, so please excuse me if my question seems too obvious. I have some code

Re: clojure.contrib.logging in side-effect free functions?

2010-06-24 Thread Laurent PETIT
2010/6/24 Laurent PETIT laurent.pe...@gmail.com: Hi, 2010/6/17 William Wadsworth will.wadsworth...@gmail.com: Hi. I have just started learning Clojure and I am really enjoying myself. However, I am still getting to grips with the workings of its concurrency model, so please excuse me if my

Re: Can't send from agent error handler?

2010-06-24 Thread ka
I'm also facing the same problem - (let [handler (agent 50) a (agent 42 :error-handler (fn [_ ex] (do (println Inside agent a error handler fn (Thread/ currentThread)) (send handler (fn [_] (do

Re: Compiling a namespace causes subsequent uses of it to fail.

2010-06-24 Thread philip.hazel...@gmail.com
On Jun 23, 12:29 pm, Stuart Halloway stuart.hallo...@gmail.com wrote: I think the behavior you are seeing here is reasonable. When you mix compilation and dynamic access to vars, you need to reason carefully about the order in which things will happen. In general I would say that code

Re: scala

2010-06-24 Thread Saul Hazledine
On Jun 18, 11:56 pm, cageface milese...@gmail.com wrote: Unfortunately there seems to be a lot more commercial momentum for Scala though. It's still a blip compared to the mainstream languages but I'm seeing more and more job posts mentioning it, and hardly any for Clojure. I don't think

Re: Enhanced Primitive Support

2010-06-24 Thread Heinz N. Gies
Another thing I noticed, clojures array functions are using int's as index, so to get best performance from them you currently need to cast every counter you use to a int by hand so you have (loop [i (int 0)] ... since otherwise there will be a lot of type casting when accessing arrays. So a

calling an overloaded java method

2010-06-24 Thread Martin DeMello
This works: (. JOptionPane showMessageDialog frame Hello World) This does not: (. JOptionPane showMessageDialog frame Hello World Title JOptionPane/PLAIN_MESSAGE) Even though JOptionPane.showMessage supports both signatures. How do I call the second one from clojure? martin -- You

Re: calling an overloaded java method

2010-06-24 Thread Meikel Brandmeyer
Hi, On Jun 24, 3:53 pm, Martin DeMello martindeme...@gmail.com wrote: This works:   (. JOptionPane showMessageDialog frame Hello World) This does not:   (. JOptionPane showMessageDialog frame Hello World Title JOptionPane/PLAIN_MESSAGE) Even though JOptionPane.showMessage supports both

Re: calling an overloaded java method

2010-06-24 Thread Martin DeMello
On Thu, Jun 24, 2010 at 7:32 PM, Meikel Brandmeyer m...@kotka.de wrote: Hi, On Jun 24, 3:53 pm, Martin DeMello martindeme...@gmail.com wrote: Both work for me. What's the error you get? Looks like my mistake, I tried it now and it works. No idea what I did wrong the last time (I got the No

Weird problem with lazy seqs and throwing exceptions

2010-06-24 Thread Steve Molitor
I'm having trouble throwing an exception with the error message I want from a list of error codes. Here's a simple example of the problem: (def messages (map #(str %) [1 2 3])) (println messages) (throw (java.lang.Exception. (str Whoops: messages))) The println prints the messages just fine -

Is it possible to define custom atom/data types?

2010-06-24 Thread Tim Robinson
Is it possible to define custom atom/data types? Example: I would like an atom prefixed with $ to maintain it's own type/class. i.e. (class $myatom) clojure.lang.CustomeName Thanks, Tim -- You received this message because you are subscribed to the Google Groups Clojure group. To post to

Data Access Layer design

2010-06-24 Thread michaelr524
Hi, I've started developing a web application using Compojure. I use CouchDB for storing data. Currently I've just created a dal.clj file to contain all the CRUD functions. I might later decide that I want to switch to other Database so I want to make the ground ready for this. So my question

Re: Question about every?

2010-06-24 Thread michele
Ok, then I understand why it didn't work, but that means that the struct (that is sent by the add-message function) is put in a sequence somewhere on the way to being validated. Is this right, and where does this happen? ;All the relevant code (defstruct message :sender :text) (def

Re: State of Clojure web development

2010-06-24 Thread Jimmy
Hi James, For me the big missing item is Comet/Websockets support. More and more of the web development I do requires near real time communication and to have that feature integrated in the framework (like lift) would be great. thanks Jimmy -- You received this message because you are subscribed

Re: clojure.contrib.logging in side-effect free functions?

2010-06-24 Thread William Wadsworth
Hi! On Jun 24, 12:04 pm, ka sancha...@gmail.com wrote: To my naive inexperienced eyes, there doesn't seem to be something obviously wrong with your code. Since FOR returns a lazy sequence of the results, is this function safe?  (Seeing that it is not side-effect free?) I'm not getting

Re: clojure.contrib.logging in side-effect free functions?

2010-06-24 Thread William Wadsworth
Hi! On Jun 24, 12:16 pm, Laurent PETIT laurent.pe...@gmail.com wrote: 2010/6/24 Laurent PETIT laurent.pe...@gmail.com: Hi, 2010/6/17 William Wadsworth will.wadsworth...@gmail.com: Hi. I have just started learning Clojure and I am really enjoying myself. However, I am still getting

Re: Weird problem with lazy seqs and throwing exceptions

2010-06-24 Thread Meikel Brandmeyer
Hi, On Jun 24, 6:34 am, Steve Molitor stevemoli...@gmail.com wrote: user= (throw (java.lang.Exception. (str Whoops: messages))) java.lang.Exception: Whoops: clojure.lang.lazy...@13291 (NO_SOURCE_FILE:0) Wrap messages into a call to seq. Sincerely Meikel -- You received this message

Re: Question about every?

2010-06-24 Thread Stuart Halloway
You are correct. The struct is a single message. The messages object holds a ref to N of them (initially an empty vector). Individual messages are added by alter ... conj in add-message. Stu Ok, then I understand why it didn't work, but that means that the struct (that is sent by the

Re: Question about every?

2010-06-24 Thread Meikel Brandmeyer
Hi, alter calls conj on [] (which is kept as a vector) since it is the initial content of the messages ref. So the content of messages is a seqable thing and not a single message. Sincerely Meikel -- You received this message because you are subscribed to the Google Groups Clojure group. To

Re: State of Clojure web development

2010-06-24 Thread Wilson MacGyver
On Wed, Jun 23, 2010 at 5:23 PM, James Reeves weavejes...@googlemail.com wrote: 1. Have you written, or are you writing, a web application that uses Clojure? What does it do? we are currently developing a game server backend using clojure. 2. Which libraries or frameworks are you using? Which

Re: ops' macro to tidy +', -', *', /' operations?

2010-06-24 Thread miner
I'd call it with-auto-promotion. -- 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 with your first post. To unsubscribe from

Re: State of Clojure web development

2010-06-24 Thread Daniel Gagnon
I don't use Clojure for web development and I thought sharing why could be useful too. For web development, my favourite tool is Djangohttp://www.djangoproject.com/. It comes as a fullstack framework which means I have everything I need out of the box. Templates, caching, ORM, a kick-ass

Re: State of Clojure web development

2010-06-24 Thread MarkSwanson
1. Have you written, or are you writing, a web application that uses Clojure? What does it do? I've created a commercial app that has the server side written start to finish in Clojure. It leverages the existing calendaring and scheduling functionality of ScheduleWorld - which was written in

Re: State of Clojure web development

2010-06-24 Thread Brenton
1. Have you written, or are you writing, a web application that uses Clojure? What does it do? I am an independent contractor and do a lot of corporate intranet web applications. All of my clients support Java. Each year I write a few new applications and spend a lot of time maintaining old Java

Re: Is it possible to define custom atom/data types?

2010-06-24 Thread Meikel Brandmeyer
Hi, Am 24.06.2010 um 07:36 schrieb Tim Robinson: Is it possible to define custom atom/data types? Example: I would like an atom prefixed with $ to maintain it's own type/class. i.e. (class $myatom) clojure.lang.CustomeName You can use the old way of defining types: by adding a tag to

Re: State of Clojure web development

2010-06-24 Thread Chas Emerick
Good point. I have a todo waiting for me to figure out how to deliver some services that HTTP might not be cut out for. It looks like v3.0 servlets have a variety of enhancements in this area, so hopefully compojure/ring can stand on those shoulders. I've no idea about the container

Re: clojure.contrib.logging in side-effect free functions?

2010-06-24 Thread Laurent PETIT
2010/6/24 William Wadsworth will.wadsworth...@gmail.com: Hi! On Jun 24, 12:16 pm, Laurent PETIT laurent.pe...@gmail.com wrote: 2010/6/24 Laurent PETIT laurent.pe...@gmail.com: Hi, 2010/6/17 William Wadsworth will.wadsworth...@gmail.com: Hi. I have just started learning Clojure and

Re: slow raw io

2010-06-24 Thread cageface
Has anyone else had a chance to try this? I'm surprised to see manual buffering behaving so much better than the BufferedReader implementation but it does seem to make quite a difference. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this

Re: Weird problem with lazy seqs and throwing exceptions

2010-06-24 Thread Steve Molitor
That did the trick, thanks. Steve On Thu, Jun 24, 2010 at 9:43 AM, Meikel Brandmeyer m...@kotka.de wrote: Hi, On Jun 24, 6:34 am, Steve Molitor stevemoli...@gmail.com wrote: user= (throw (java.lang.Exception. (str Whoops: messages))) java.lang.Exception: Whoops:

Re: Is it possible to define custom atom/data types?

2010-06-24 Thread Tim Robinson
Thanks! I think that should do it for me. I've been writing my own custom *semi* JSON parser/combinator (JSON only hacked to let me to include js functions). My first cut works, but I had implemented string searches for js qualifiers. I didn't like the implementation since it string searches

Re: State of Clojure web development

2010-06-24 Thread Martin Jul
We have written a currency trading app in Clojure in my company. It has an embedded web server with a compojure app that provides an administration interface. 2. Which libraries or frameworks are you using? Which versions? Some relevant dependencies are: [compojure

Re: State of Clojure web development

2010-06-24 Thread Tim Robinson
1. Have you written, or are you writing, a web application that uses Clojure? What does it do? I am new to Clojure, I've ported over most of my code for an ad-hoc application creator / with reporting and GIS integration. I'm pretty much finished. I benchmarking speed. 2. Which libraries or

Re: State of Clojure web development

2010-06-24 Thread David Nolen
On Thu, Jun 24, 2010 at 3:12 PM, Tim Robinson tim.blacks...@gmail.comwrote: (def stuff {:key1 {:item1 {:sub1 val1}}) (((stuff :key1) :item1) sub1) --- YUCK val1 (get-in m [:key1 :item1 :sub1]) --- YUM ;) (rest stuff) (2 3 4 5) (next stuff) (2 3 4 5) this can be done

Re: State of Clojure web development

2010-06-24 Thread David Nolen
On Thu, Jun 24, 2010 at 12:27 PM, Daniel Gagnon redalas...@gmail.comwrote: I don't use Clojure for web development and I thought sharing why could be useful too. For web development, my favourite tool is Djangohttp://www.djangoproject.com/. It comes as a fullstack framework which means I

Protocols and visitor pattern

2010-06-24 Thread Brent Millare
Are there any good articles on clojure double dispatch using protocols (not multimethods) via the visitor pattern or whatever would be appropriate? I feel like that after single dispatch on type, double dispatch on type is the next common use case for multimethods. I somewhat recall Rich talking

Re: State of Clojure web development

2010-06-24 Thread Tim Robinson
Thanks for both the replies. (get-in m [:key1 :item1 :sub1]) --- YUM ;) (- stuff :key1 :item1 sub1) are better than what I've been doing! Re: (next...) I still like mine better, fortunately I can create my own functions, but I was just highlighted that some of the function names are not

Re: Hiring again - need 3 devs before fall 2010

2010-06-24 Thread Steve Molitor
Tim, I just sent my resume to j...@sonian.net. Thanks! Steve Molitor On Wed, Jun 23, 2010 at 12:02 PM, Tim Dysinger t...@dysinger.net wrote: Sorry I didn't provide enough detail on that last post. Please send your interest to jobs on sonian.net with clojure in the subject. On Wed, Jun

Re: Trying to make my code extensible

2010-06-24 Thread Brent Millare
If anyone is curious, I ended up learning about and using protocols. It was pretty trivial to convert since it was basically what I was already doing, although I wasn't really using protocols for dispatching but for grouping of functions together with shared data. On Jun 1, 7:09 pm, Brent Millare

New Primitive data types (equal branch) - impact on optimized code.

2010-06-24 Thread Heinz N. Gies
So out of curiosity I did some benchmarking of the new equal branch and wanted to see how much I can get out of clojure if I push the limits. Now that said I know equal isn't done yet but I figured it won't hurt. Bad news first, despite all my attempts clojure was still slower then optimized

Re: New Primitive data types (equal branch) - impact on optimized code.

2010-06-24 Thread David Nolen
On Thu, Jun 24, 2010 at 5:08 PM, Heinz N. Gies he...@licenser.net wrote: So out of curiosity I did some benchmarking of the new equal branch and wanted to see how much I can get out of clojure if I push the limits. Now that said I know equal isn't done yet but I figured it won't hurt. Bad news

Re: State of Clojure web development

2010-06-24 Thread Meikel Brandmeyer
Hi, Am 24.06.2010 um 21:12 schrieb Tim Robinson: I would like some chaining to less the brackets. i.e. (def stuff {:key1 {:item1 {:sub1 val1}}) (((stuff :key1) :item1) sub1) --- YUCK val1 Instead do this: stuff:key1:item1:sub1 val1 (- stuff :key1 :item1 sub1) Also, some of

Re: New Primitive data types (equal branch) - impact on optimized code.

2010-06-24 Thread David Nolen
On Thu, Jun 24, 2010 at 5:17 PM, David Nolen dnolen.li...@gmail.com wrote: On Thu, Jun 24, 2010 at 5:08 PM, Heinz N. Gies he...@licenser.net wrote: So out of curiosity I did some benchmarking of the new equal branch and wanted to see how much I can get out of clojure if I push the limits. Now

Re: State of Clojure web development

2010-06-24 Thread Meikel Brandmeyer
Hi, Am 24.06.2010 um 22:07 schrieb Tim Robinson: Along this vein, I find the documentation is great, but a little hard to navigate around. http://richhickey.github.com/clojure http://richhickey.github.com/clojure-contrib Note the branch links on the top left. Sincerely Meikel -- You

Re: New Primitive data types (equal branch) - impact on optimized code.

2010-06-24 Thread Michał Marczyk
On 24 June 2010 23:17, David Nolen dnolen.li...@gmail.com wrote: Don't have time to dive into this right now, but all I can say is now you are starting to have an idea what the other side looks like. The kind of hoop jumping you have to do get within 3x of Scala is absurd. I have to admit this

Re: New Primitive data types (equal branch) - impact on optimized code.

2010-06-24 Thread David Nolen
If you want some ideas: http://gist.github.com/452032 This was posted earlier in the ML in an un-optimized Clojure form as taking 98secs while the Java version took about 16ms on the OP's machine. With Rich's latest changes this optimized Clojure code runs in about 20-25ms on my i7 laptop. David

Re: clojure.xml/parse cannot handle filenames containing #

2010-06-24 Thread Zak Wilson
On Jun 23, 11:37 pm, Stuart Halloway stuart.hallo...@gmail.com wrote: I can certainly see why this would be confusing! Is there a way to make it better without violating the expectations of someone who knows the Java API and expects strings to be treated as URIs? Perhaps throwing an

Having trouble with labrepl jars

2010-06-24 Thread Harrison Maseko
Hi, I am a newbie trying to learn Clojure. I would like to try the labrepl environment, but due to my circumstances I have to download all the jars manually one by one and install them manually in NetBeans. The trouble is, I cannot find most of the jars to download. So far, I have

Re: slow raw io

2010-06-24 Thread cageface
I put a self-contained test up here: http://gist.github.com/452095 To run it copy this to slurptest.clj and run these commands java clojure.main slurptest.clj makewords 100 (100 seems good for macs, 300 for linux) java -Xmx3G -Xms3G clojure.main slurptest.clj slurp| slurp2 Trying either slurp

Re: Having trouble with labrepl jars

2010-06-24 Thread Michał Marczyk
Really no way that you could download the dependency jars through, say, Maven...? (As documented in labrepl's readme [1].) If not, you can download the jars from the Maven repositories by hand. The relevant repos are Hudson [2] (for clojure.jar and clojure-contrib.jar; use the releases section),

Re: State of Clojure web development

2010-06-24 Thread Mike Meyer
1. Have you written, or are you writing, a web application that uses Clojure? What does it do? roman candle is a web app designed to let me control X10 plc components from any web-capable device, using the X10 firecracker controller. It's still in very early development, and hasn't been given

Re: Enhanced Primitive Support

2010-06-24 Thread Mike Meyer
[Not really about enhanced primitive support - more about optimization on the jvm.] On Tue, 22 Jun 2010 01:47:26 -0400 David Nolen dnolen.li...@gmail.com wrote: Yet consider this, If I'm writing OpenGL code in Penumbra I will have quite a bit of code that amounts to the following: ; 630

Re: State of Clojure web development

2010-06-24 Thread Howard Lewis Ship
On Wed, Jun 23, 2010 at 2:23 PM, James Reeves weavejes...@googlemail.com wrote: Hello there! Chas Emerick's recent State of Clojure survey [http://bit.ly/dtdAwb] indicated that a significant proportion of Clojure users are beginning to use Clojure for web development. A recent Hacker News

Re: New Primitive data types (equal branch) - impact on optimized code.

2010-06-24 Thread Mark Engelberg
When exactly did people start expecting Clojure to be as fast as Java and/or Scala? I seem to recall in one of the original Clojure videos, Rich talked about the relationship between Clojure and Java. There's a long history of C programmers dropping down to assembly, Python programmers dropping

Re: New Primitive data types (equal branch) - impact on optimized code.

2010-06-24 Thread Wilson MacGyver
On Jun 24, 2010, at 10:50 PM, Mark Engelberg mark.engelb...@gmail.com wrote: When exactly did people start expecting Clojure to be as fast as Java and/or Scala? One of the earlier talk/video, the claim was clojure is between 1x to 3x of java performance. Fast math performance was touched

Re: New Primitive data types (equal branch) - impact on optimized code.

2010-06-24 Thread Richard Newman
Mark, I don't disagree with your message as a whole, but: Once you start using mutable arrays and type hinting every single variable, why aren't you just using Java? The argument I've heard is this: there are two ways to get a fast program in a slow-by-default language. The first is

Re: New Primitive data types (equal branch) - impact on optimized code.

2010-06-24 Thread David Nolen
On Thu, Jun 24, 2010 at 10:50 PM, Mark Engelberg mark.engelb...@gmail.comwrote: With respect to this particular benchmark, I don't think it will be possible to get idiomatic code in the same ballpark as Java, because if you use Clojure's vectors to store the permuted values, they will be