Re: Optimizing JDBC code

2011-08-07 Thread Shantanu Kumar
On Aug 7, 10:51 am, Shoeb Bhinderwala wrote: > I switched to clojure.java.jdbc. Found no difference at all. It is > still about 10 times slower than java. I guess you can now get c.j.jdbc and put (time ...) wrappers in the call path in it to see where is the time mostly spent. Do share your fi

Re: Optimizing JDBC code

2011-08-07 Thread Sean Corfield
On Sat, Aug 6, 2011 at 10:51 PM, Shoeb Bhinderwala < shoeb.bhinderw...@gmail.com> wrote: > I switched to clojure.java.jdbc. Found no difference at all. It is > still about 10 times slower than java. > Thanx. I wanted to eliminate reflection as the potential culprit. Have you tried Clojure 1.3, j

Re: Optimizing JDBC code

2011-08-07 Thread Sean Corfield
On Sat, Aug 6, 2011 at 11:04 PM, jaime wrote: > Hi guys, I just want to learn using databases in Clojure, can you > suggest where to start? by looking at source code of clojure.java.jdbc/ > clojure.contrib.sql or there's some tutorial/document that I can start > with? > The tests in c.j.j are pr

ClojureScript broken

2011-08-07 Thread ataggart
After introducing clojure to co-workers on Friday, one of them tried the ClojureScript quick start. He got this far: $ bin/cljsc hello.cljs '{:optimizations :advanced}' > hello.js Exception in thread "main" java.lang.NullPointerException at clojure.java.io$as_relative_path.invoke(io.clj:391) at

Re: clojurescript advanced compile error

2011-08-07 Thread Tero Parviainen
> So I'm assuming that the problem is in the use of .strobj, and there is some > better way to convert the clojure map to a javascript map that outputs > symbol style keys rather than string style keys - is there a simple way to > do that?  Would that fix the problem? Yeah, outputting symbol style

Re: ClojureScript broken

2011-08-07 Thread Brenton
The problem existed from Friday at about 10AM until Saturday morning when it was found and fixed. It only occurred when compiling something in advanced mode for the first time, which is probably why it was missed. There are some tests in place but we haven't yet got to the point where everything is

Re: JSON library for clojure 1.3

2011-08-07 Thread Stuart Sierra
Hi Arthur, I think thos would make a reasonable addition. If you'll make a JIRA ticket in the backlog, I'll see if I can push it forward. Ultimately, it will be Rich's decision, of course. Thanks, -Stuart Sierra clojure.com -- You received this message because you are subscribed to the Google

Re: (:key map) lookup vs accessor functions in large applications

2011-08-07 Thread Stuart Sierra
Hi Martin, It's definitely a concern, keeping track of map keys and finding mis-typed names. I always use keywords instead of accessor functions, though. If there were functions, it's just one more thing to rename when refactoring. Pre/post conditions are your friend here. Write a validator fun

Re: Optimizing JDBC code

2011-08-07 Thread Stuart Sierra
Hi Shoeb, At this point, we probably need more data to give a meaningful answer. Different core data structures and different coding conventions can mean that "the same code" in Clojure and Java will behave quite differently. Try profiling your Clojure code with a Java profiler such as VisualVM

standalone indentation tool

2011-08-07 Thread Philipp Steinwender
hi! Is there a tool available that does indentation of clojure code and does not depend on an editor/IDE? we work on the same code together with different editors (eclipse+counterclockwise and emacs). We often reindent the other's code what leads to changes when we merge our commits with git.

Re: ClojureScript broken

2011-08-07 Thread ataggart
Alas, the current bug is in the head of master, and is unrelated to either advanced-mode or the absence of the destination file. Rather it appears to be due to the fact that the quick start doesn't pass an output file to cljsc, but rather redirects stdout to the destination file. When that occ

Re: (:key map) lookup vs accessor functions in large applications

2011-08-07 Thread Sebastián Galkin
I have suffered the exact same problem in large projects. Clojure's associative style is extremely powerful and simple, together with powerful sequence handling functions you could hurt yourself. The fact that it's really easy to put together nested maps to represent your models, shouldn't be a

Re: standalone indentation tool

2011-08-07 Thread Eric Lavigne
The pprint function in the Clojure standard library indents Clojure source code. http://richhickey.github.com/clojure/clojure.pprint-api.html To get the result you are looking for, a tool would need to walk through all the *.clj files in your source directory and, for each file, read in the

Re: standalone indentation tool

2011-08-07 Thread Ken Wesson
On Sun, Aug 7, 2011 at 1:44 PM, Eric Lavigne wrote: > The pprint function in the Clojure standard library indents Clojure source > code. >      http://richhickey.github.com/clojure/clojure.pprint-api.html > To get the result you are looking for, a tool would need to walk through all > the *.clj fi

Re: standalone indentation tool

2011-08-07 Thread Eric Lavigne
> > > > The pprint function in the Clojure standard library indents Clojure > source > > code. > > http://richhickey.github.com/clojure/clojure.pprint-api.html > > Er, won't you lose all comments and have reader macros expanded if you > use read/pprint to do the transformation? > Oops. I thin

Re: ClojureScript broken

2011-08-07 Thread Brenton
Sorry. I didn't notice that you were compiling a single file. That is a different problem from the one I was referring to. You were right about the cause as well. That particular problem is now fixed. Thank you for reporting it. On Aug 7, 11:52 am, ataggart wrote: > Alas, the current bug is in

Re: JSON library for clojure 1.3

2011-08-07 Thread Aaron Bedra
Perhaps we can put these in core.incubator for now so they have a place to live in the 1.3 world. The function for this library is the staging of things that are destined for core itself, so it might not be a bad idea. Cheers, Aaron Bedra -- Clojure/core http://clojure.com On 08/07/2011 10:1

ClojureScript macro import

2011-08-07 Thread Kevin Lynagh
Is it possible to use macros within ClojureScript without having to fully reference them? Right now I have (ns hack.cljs.hello (:require-macros [d3-macros :as d3m])) and have to use the form (d3m/my-macro ...) Ideally I could just say (my-macro ...) Is this possible? Bonus

Re: ClojureScript broken

2011-08-07 Thread ataggart
Great. BTW, are these warnings expected: $ cat > hello.cljs (ns hello) (defn ^:export greet [n] (str "Hello " n)) $ bin/cljsc hello.cljs '{:optimizations :advanced}' > hello.js Aug 7, 2011 12:17:42 PM com.google.javascript.jscomp.LoggerErrorManager println WARNING: /Users/ataggart/projects/clo

Re: ClojureScript broken

2011-08-07 Thread Brenton
Those warnings have been around for a couple of weeks now. In that sense they are expected. I will see what I can find out about them. On Aug 7, 3:19 pm, ataggart wrote: > Great. > > BTW, are these warnings expected: > > $ cat > hello.cljs > (ns hello) > (defn ^:export greet [n] >   (str "Hello "

Re: standalone indentation tool

2011-08-07 Thread Alan Malloy
On Aug 7, 11:10 am, Eric Lavigne wrote: > > > The pprint function in the Clojure standard library indents Clojure > > source > > > code. > > >      http://richhickey.github.com/clojure/clojure.pprint-api.html > > > Er, won't you lose all comments and have reader macros expanded if you > > use read

Re: standalone indentation tool

2011-08-07 Thread Phil Hagelberg
On Sun, Aug 7, 2011 at 6:17 AM, Philipp Steinwender wrote: > Is there a tool available that does indentation of clojure code and does not > depend on an editor/IDE? > we work on the same code together with different editors > (eclipse+counterclockwise and emacs). We often reindent the other's code

Re: JSON library for clojure 1.3

2011-08-07 Thread Sean Corfield
Wouldn't string.incubator be better, for possible inclusion in clojure.string (rather than core.incubator for clojure.core). Seems more consistent... Otherwise things will be moving from c.contrib.foo to c.core.incubator and then (possibly) to c.foo... On Sun, Aug 7, 2011 at 12:17 PM, Aaron Bedra

Re: ClojureScript broken

2011-08-07 Thread Brenton
> WARNING - dangerous use of the global this object These warnings should now be gone (thanks to Fogus). On Aug 7, 3:19 pm, ataggart wrote: > Great. > > BTW, are these warnings expected: > > $ cat > hello.cljs > (ns hello) > (defn ^:export greet [n] >   (str "Hello " n)) > $ bin/cljsc hello.cljs

Re: (:key map) lookup vs accessor functions in large applications

2011-08-07 Thread Sean Corfield
2011/8/7 Sebastián Galkin > (-> car :wheels first :tire :pressure) > > This probably lacks abstraction, calling code needs to know every details > about how to get the pressure starting from a car model. If at some point > you decide to change your implementation and turn :wheels into a map inste

"Elegant tools deserve elegant solutions." -- L. E. Gant

2011-08-07 Thread Tuba Lambanog
Hello, I’m doing a word stemmer for a non-English language. A stemmer parses a word into its word parts: prefixes, roots, suffixes. The input word is at least a root word (English example would be ‘cloud’), but can be any combination of prefix(es) and a root (e.g., 'pre-nuptial'), or a root and s