Re: sql utilities

2010-10-18 Thread Emeka
Beautiful . Emeka On Fri, Oct 15, 2010 at 1:08 AM, Stuart Campbell stu...@harto.org wrote: Thanks Kyle. Looks useful! On 15 October 2010 09:25, Saul Hazledine shaz...@gmail.com wrote: On Oct 14, 9:16 pm, Kyle R. Burton kyle.bur...@gmail.com wrote: I've written some sql helper functions

Re: Traffic junctions as a metaphor for understanding the STM?

2010-10-18 Thread michele
There is a difference between having limitations and not being applicable. The movement of cars through a road intersection is a metaphor for processes that simultaneously want to change a resource. The traffic signal is there to hinder these cars to crash, i.e. to make changes in an uncontrolled

Pros and cons of macro versus functions

2010-10-18 Thread jbk
I'm new to Clojure and just getting my head around macros. As an exercise I was trying different ways to wrap making a proxy for java.util.Comparator and came up with two alternatives. I'm really not sure how to judge what would favour one solution over the other, and I'm curious if one style is

Simple loop in Clojure is ~15 times slower than in Java

2010-10-18 Thread Dmitriy S.
Hi All, I stuck with performance problem using Clojure. It seems that when all the optimisation hints are used, Clojure data processing is still much slower than Java. In my simple test I sum up 16M of random integers 0 n 10. The code is as follows (see below Java and C code, and the test

Re: Simple loop in Clojure is ~15 times slower than in Java

2010-10-18 Thread Jürgen Hötzel
Hi, (defn sum [^ints arr] (areduce arr i ret (int 0) (unchecked-add-int ret (aget arr i 2010/10/18 Dmitriy S. samborsk...@yahoo.com: (defn sum [arr]  (loop [i (int 0) s (int 0)]    (if (= i *N*) s ^^^ You still doing non-primitive ops here. Also Check for areduce:

Network class loader

2010-10-18 Thread Ingmar
Hi community, I'm using clojure for having a dynamic programming environment in terms of a client-server process. This is needed for a highly flexible communication system. The clojure system defines the server, a programming environment like emacs provides the client. The communication in

Re: Simple loop in Clojure is ~15 times slower than in Java

2010-10-18 Thread Dmitriy S.
On Oct 18, 3:07 pm, Jürgen Hötzel juer...@hoetzel.info wrote: (defn sum [arr] (loop [i (int 0) s (int 0)] (if (= i *N*) s ^^^ You still doing non-primitive ops here. Indeed, I overlooked that. But this was not the main cause of the trouble. Also Check for areduce: (defn

Re: Simple loop in Clojure is ~15 times slower than in Java

2010-10-18 Thread nicolas.o...@gmail.com
I happened to stumble on something like that in 1.2, with = slower than =, which is in turn slower than zero?. (Even when everything is a primitive) I never really understood why and would be happy to understand it better. Dimitry, have you tryed to replace (= x y) by (zero? (- x u)), or with an

Re: Pros and cons of macro versus functions

2010-10-18 Thread lprefontaine
Choose functions over macros when you can write an equivalent function. I use macros when: a) I have a repetitive pattern in the code that cannot be easily turned into a function (too much context to pass as args to a function). You can then hide a binding form in the macro to refer to the

Re: Simple loop in Clojure is ~15 times slower than in Java

2010-10-18 Thread Dmitriy S.
On Oct 18, 4:44 pm, nicolas.o...@gmail.com nicolas.o...@gmail.com wrote: I happened to stumble on something like that in 1.2, with = slower than =, which is in turn slower than zero?. (Even when everything is a primitive) I never really understood why and would be happy to understand it

Re: Simple loop in Clojure is ~15 times slower than in Java

2010-10-18 Thread nicolas.o...@gmail.com
You can try == for numbers -- 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 this

Re: Simple loop in Clojure is ~15 times slower than in Java

2010-10-18 Thread Dmitriy S.
On Oct 18, 5:15 pm, nicolas.o...@gmail.com nicolas.o...@gmail.com wrote: You can try == for numbers 17 msec (== ~idx (alength a#)) 293 msec (= ~idx (alength a#)) Yes, it's the case. I should have checked the API doc for the =/== difference. Thank you very much. Best regards, Dmitriy --

Re: Pros and cons of macro versus functions

2010-10-18 Thread Mike Meyer
On Mon, 18 Oct 2010 08:58:48 -0400 (EDT) lprefonta...@softaddicts.ca wrote: Choose functions over macros when you can write an equivalent function. From the LISP community, I'd put it slightly stronger: Only use macros when you have to. But you get the same set of reasons (with explanations).

Re: Simple loop in Clojure is ~15 times slower than in Java

2010-10-18 Thread Jürgen Hötzel
2010/10/18 Dmitriy S. samborsk...@yahoo.com: On Oct 18, 3:07 pm, Jürgen Hötzel juer...@hoetzel.info wrote: (defn sum [arr]  (loop [i (int 0) s (int 0)]    (if (= i *N*) s ^^^ You still doing non-primitive ops here. Indeed, I overlooked that. But this was not the main cause of

Re: Newbie : Java Interop question

2010-10-18 Thread oak
P = Property. Guess it could have been lower case p. On Oct 15, 11:19 pm, Michael Ossareh ossa...@gmail.com wrote: On Fri, Oct 15, 2010 at 09:32, oak ismail.oka...@gmail.com wrote: Hi All, This is how i see the package in package explorer. IEssbase.class  (I) IEssbase      (C, s f)

Re: Simple loop in Clojure is ~15 times slower than in Java

2010-10-18 Thread Dmitriy S.
On Oct 18, 5:46 pm, Jürgen Hötzel juer...@hoetzel.info wrote: Note the difference between = and ==, = will result in a cast to the wrapped types for it's arguments. It seems that '=' is always slower than '==', even if types are primitive, look: Clojure 1.2.0 user= (time (let [a (int 3) b (int

Re: Simple loop in Clojure is ~15 times slower than in Java

2010-10-18 Thread Dmitriy S.
On Oct 18, 5:46 pm, Jürgen Hötzel juer...@hoetzel.info wrote: Note the difference between = and ==, = will result in a cast to the wrapped types for it's arguments. It seems that '=' is always slower than '==', even if types are primitive, look: Clojure 1.2.0 user= (time (let [a (int 3) b (int

SQLAlchemy in Clojure?

2010-10-18 Thread Sean Devlin
Okay, I just finished a Python app for work. Using SQLAlchemy was a joy. Has anyone ported this yet? -- 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: Newbie : Java Interop question

2010-10-18 Thread oak
Thanks just what needed to know On Oct 15, 11:13 pm, Randy Hudson randy_hud...@mac.com wrote: Nested classes require the syntax AClass$NestedClass -- this being the real name of the class in the JVM. Static members of classes are referenced as AClass/member -- essentially treating the class

Conj arrivals and Thursday night...

2010-10-18 Thread Andrew Gwozdziewycz
Hey Conj goers, I'm scheduled to arrive around 6:30, and after I check in am planning to spend the rest of the night writing code. Anyone want to help commandeer a random lobby to join in on the fun? Andrew -- http://www.apgwoz.com -- You received this message because you are subscribed to

Re: SQLAlchemy in Clojure?

2010-10-18 Thread Andrew Gwozdziewycz
I think it's very unlikely that someone will port SQLAlchemy to java. However, there are lots of ORMs which maybe suitable for you to use from clojure--maybe with some macros to make it a bit nicer. WikiPedia has a great list of these:

Re: Conj arrivals and Thursday night...

2010-10-18 Thread Ryan Waters
I probably wouldn't be able to show up until 8:00pm but I'd be interested in getting on the 'list' for said group. Thanks, Ryan On Mon, Oct 18, 2010 at 11:32 AM, Andrew Gwozdziewycz apg...@gmail.com wrote: Hey Conj goers, I'm scheduled to arrive around 6:30, and after I check in am planning

Need some help with static files and ring...

2010-10-18 Thread lprefontaine
Hi everyone, I have been banging my head on the walls for a few hours now and really cannot figure out the proper way to serve static files in a Compojure application deployed on Tomcat or Glassfish... Feeling pretty dumb in fact... I tried to configure the default servlet to catch up requests

Re: Conj arrivals and Thursday night...

2010-10-18 Thread lprefontaine
Count me out, pretty sure I'll need a drink by the time I arrive (21:00). I like so much airplane travels, livestock receives more attention from their carriers than airline passengers these days. Meuh ! Luc P. Ryan Waters ryan.or...@gmail.com wrote .. I probably wouldn't be able to show up

Re: Conj arrivals and Thursday night...

2010-10-18 Thread Peter Buckley
I'll be arriving between 9:30 and 10pm, and I expect to be up for some coding or a drink, or perhaps a little of both. -Peter On Mon, Oct 18, 2010 at 2:12 PM, lprefonta...@softaddicts.ca wrote: Count me out, pretty sure I'll need a drink by the time I arrive (21:00). I like so much airplane

Array types in multimethod?

2010-10-18 Thread stefanmuenchow
Hey :) I have a little problem defining a multimethod with an array type as parameter. I have something like this: (defmulti amethod (fn [ args] (vec (map class args (defmethod amethod [[C] ([par1] (String. par1))) I want to pass a char-array as parameter. The internal java name i [C,

Re: Array types in multimethod?

2010-10-18 Thread Meikel Brandmeyer
Hi, user= (defmulti foo type) #'user/foo user= (defmethod foo (Class/forName [C) [_] (println It's an array!)) #MultiFn clojure.lang.mult...@2fbb3e9a user= (foo (make-array Character/TYPE 1)) It's an array! nil Could be easier... Hope this helps. Sincerely Meikel -- You received this message

Dot special form problem.

2010-10-18 Thread Sergio Arbeo
Hello, everyone, I'm having problems with the dot special form. First things first, I have src-out defined this way: http://gist.github.com/632852 Then, I have problems using that function as an argument for a macro: http://gist.github.com/632849 Evaluation aborted throws an exception, shown

Re: Need some help with static files and ring...

2010-10-18 Thread Linus Ericsson
This tutorial covers the subject pretty well, I assume you've already read it. http://mmcgrana.github.com/2010/07/develop-deploy-clojure-web-applications.html according to it you should use Next, include the necessary Ring middleware: (:use ring.middleware.file) (:use

Re: Dot special form problem.

2010-10-18 Thread Kevin Downey
clojure works something like reader - macro expansion - compiler (eval) - run the exception you are seeing means that your macro expansion contains a form that the compiler doesn't know how to generate code for. for example if your macro expansion contained a Graphics2d object the compiler would

Re: Need some help with static files and ring...

2010-10-18 Thread lprefontaine
This is a more recent tutorial than what I had in my hands up to now so I'll work on it tonight and look at the example app closely. Thank you Luc P. Linus Ericsson oscarlinuserics...@gmail.com wrote .. This tutorial covers the subject pretty well, I assume you've already read it.

Re: Conj arrivals and Thursday night...

2010-10-18 Thread Kyle R. Burton
Andrew, Several of us are car pooling down from Philly and should be arriving some time between 6 and 8pm. I will be hoping to drop off our bags and get dinner somewhere and otherwise be social with other conferencegoers. Are there any recommendations for dinner the night before? Any social

Re: Need some help with static files and ring...

2010-10-18 Thread David Jagoe
Hey Luc, Are you deploying to Tomcat using a war file? Are you perhaps missing the :web-content key in your project.clj file (I presume you're using Leiningen + leiningen-war) (defproject myproject 0.0.1 :description :dependencies [[org.clojure/clojure 1.2.0] ... ]

Re: SQLAlchemy in Clojure?

2010-10-18 Thread Michael Ossareh
On Mon, Oct 18, 2010 at 11:18 AM, Sean Devlin francoisdev...@gmail.com wrote: Okay, I just finished a Python app for work. Using SQLAlchemy was a joy. Has anyone ported this yet? Having never used SQLAlchemy, and rarely python, what are the benefits of SQLAlchemy? My only experience

Re: Need some help with static files and ring...

2010-10-18 Thread James Reeves
On 18 October 2010 19:06, lprefonta...@softaddicts.ca wrote: The routes are the following (after several attempts with the file wrapper): (defroutes app-routes   (GET /patient [patient-id]     (render-page Dossier médical) (render-page (load-patient-mr patient-id)))  (GET /req req (str

Re: Simple loop in Clojure is ~15 times slower than in Java

2010-10-18 Thread Jürgen Hötzel
2010/10/18 Dmitriy S. samborsk...@yahoo.com: On Oct 18, 5:46 pm, Jürgen Hötzel juer...@hoetzel.info wrote: Note the difference between = and ==, = will result in a cast to the wrapped types for it's arguments. It seems that '=' is always slower than '==', even if types are primitive, look:

Re: Conj arrivals and Thursday night...

2010-10-18 Thread Toni Batchelli
I'll be in by 7pm or so. I am down for coding and coffee, or drinks and no coding, or what the hell, drinks and coding, but then no git commits... Toni. On Mon, Oct 18, 2010 at 9:32 AM, Andrew Gwozdziewycz apg...@gmail.comwrote: Hey Conj goers, I'm scheduled to arrive around 6:30, and after

Re: Conj arrivals and Thursday night...

2010-10-18 Thread Eric Lavigne
Hey Conj goers, I'm scheduled to arrive around 6:30, and after I check in am planning to spend the rest of the night writing code. Anyone want to help commandeer a random lobby to join in on the fun? Andrew Count me in. Sounds like a great way to kick off the conference. My plane gets in

Keyword names and namespaces

2010-10-18 Thread Rob Lachlan
There seems to be a discrepancy between what keyword names are supposed to be allowed, according to the reader documentation, and which the reader actually allows. For instance, periods are supposed to be disallowed in keyword names, and only one forward slash allowed, but no errors are thrown at

Re: Conj arrivals and Thursday night...

2010-10-18 Thread Seth
What's this about an after party? On Oct 18, 5:59 pm, Eric Lavigne lavigne.e...@gmail.com wrote: Hey Conj goers, I'm scheduled to arrive around 6:30, and after I check in am planning to spend the rest of the night writing code. Anyone want to help commandeer a random lobby to join in on

Re: Keyword names and namespaces

2010-10-18 Thread Abhishek Reddy
Hi, The reader (LispReader) and the interning functions (symbol and keyword) are separate. The reader tries to enforce some constraints, but overlooks some edge cases, before eventually interning. The interning functions do not validate input. Besides the problems you raised, there are some

Re: Conj arrivals and Thursday night...

2010-10-18 Thread Eric Lavigne
What's this about an after party? I received an email today at 1:22pm with the following link, but when I tried to register at ~4pm it said sold out. More recently, tickets became available again and I have one printed out on my desk. Hopefully there's one left for you, too. :-)

Re: Conj arrivals and Thursday night...

2010-10-18 Thread lprefontaine
Hu ? What party ? Where ? When ? Luc Seth seth.schroe...@gmail.com wrote .. What's this about an after party? On Oct 18, 5:59 pm, Eric Lavigne lavigne.e...@gmail.com wrote: Hey Conj goers, I'm scheduled to arrive around 6:30, and after I check in am planning to spend the rest of

Re: Conj arrivals and Thursday night...

2010-10-18 Thread lprefontaine
No email received but just got one :))) Luc P. Eric Lavigne lavigne.e...@gmail.com wrote .. What's this about an after party? I received an email today at 1:22pm with the following link, but when I tried to register at ~4pm it said sold out. More recently, tickets became available again

Re: Simple loop in Clojure is ~15 times slower than in Java

2010-10-18 Thread Sean Corfield
Using the latest 1.3.0-master-SNAPSHOT: user= (time (let [a (int 3) b (int 5)] (dotimes [_ 100] (== a b Elapsed time: 3.355 msecs nil user= (time (let [a (int 3) b (int 5)] (dotimes [_ 100] (= a b Elapsed time: 3.884 msecs nil Yay! On Mon, Oct 18, 2010 at 2:40 PM, Jürgen Hötzel

Re: Conj arrivals and Thursday night...

2010-10-18 Thread Michael Ossareh
Eric Lavigne lavigne.e...@gmail.com wrote .. What's this about an after party? jealous :( /me darns this startup life that doesn't permit travel -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to

Re: Dot special form problem.

2010-10-18 Thread Sergio Arbeo
So sorry. Now it is working. Don't know why though. -- http://sergio.arbeo.net http://www.serabe.com -- 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

Best syntax for clojure-clr generics

2010-10-18 Thread Seth
I would like to start a discussion on the best syntax for clojure-clr generics because in most large pieces of software on CLR you have to specify types to create generic classes. Heres my proposal. Reader macro expands to the macro g example: (AGenericClass. Double Integer

Re: Dot special form problem.

2010-10-18 Thread Sergio Arbeo
On 18 October 2010 22:05, Kevin Downey redc...@gmail.com wrote: clojure works something like reader - macro expansion - compiler (eval) - run the exception you are seeing means that your macro expansion contains a form that the compiler doesn't know how to generate code for. for example if

Re: Conj arrivals and Thursday night...

2010-10-18 Thread Andrew Gwozdziewycz
On Mon, Oct 18, 2010 at 4:13 PM, Kyle R. Burton kyle.bur...@gmail.com wrote: Andrew, Several of us are car pooling down from Philly and should be arriving some time between 6 and 8pm.  I will be hoping to drop off our bags and get dinner somewhere and otherwise be social with other

Re: Conj arrivals and Thursday night...

2010-10-18 Thread Christopher Petrilli
I'll be driving down from DC, and probably arriving between 5-6. Just as a note, I'd highly recommend not being anywhere near DC between 4-8p due to traffic. It could easily add 2 hours to your trip. On Mon, Oct 18, 2010 at 4:13 PM, Kyle R. Burton kyle.bur...@gmail.com wrote: Andrew, Several

Re: Keyword names and namespaces

2010-10-18 Thread Phil Hagelberg
On Mon, Oct 18, 2010 at 3:02 PM, Rob Lachlan robertlach...@gmail.com wrote: There seems to be a discrepancy between what keyword names are supposed to be allowed, according to the reader documentation, and which the reader actually allows.  For instance, periods are supposed to be disallowed

Behaviour of clojure.set functions with non-sets.

2010-10-18 Thread Phil Hagelberg
It looks like the behaviour of some clojure.set functions is either undefined or possibly erroneous when called with non-set arguments: user (clojure.set/union #{:a :b} [:b :c]) #{:a :c :b} user (clojure.set/union #{:a} [:b :c]) [:b :c :a] Seems likely that the behaviour in such cases is just