is org.clojure/java.jdbc part of the official clojure

2013-01-15 Thread Josh Kamau
Hi there , I am a little confused here (no big deal though) . Is org.clojure/java.jdbc an official clojure library? if yes, why is the version still 0.2.3 and not 1.4.x as clojure ? TIA Josh -- You received this message because you are subscribed to the Google Groups Clojure group. To post to

Re: pool-map - a more disciplined version of pmap on top of executors

2013-01-15 Thread Marko Topolnik
On Tuesday, January 15, 2013 12:36:04 AM UTC+1, Jim foo.bar wrote: On 14/01/13 22:15, Marko Topolnik wrote: But... you were quite clear in stating that your function isn't lazy, and you were right to say that: *doall* will not return until *all* the tasks have completed. Maybe you did

Re: is org.clojure/java.jdbc part of the official clojure

2013-01-15 Thread Andy Fingerhut
java.jdbc is one of several Clojure contrib libraries, others of which you can see listed in the two places below: https://github.com/clojure http://dev.clojure.org/display/design/Where+Did+Clojure.Contrib+Go They are like Clojure in that they are released under the same Eclipse Public

Re: is org.clojure/java.jdbc part of the official clojure

2013-01-15 Thread Josh Kamau
Andy; Thanks for the clarification. Josh. On Tue, Jan 15, 2013 at 1:20 PM, Andy Fingerhut andy.finger...@gmail.comwrote: java.jdbc is one of several Clojure contrib libraries, others of which you can see listed in the two places below: https://github.com/clojure

Re: pool-map - a more disciplined version of pmap on top of executors

2013-01-15 Thread Jim foo.bar
On 15/01/13 09:25, Marko Topolnik wrote: The order in which you are polling is not very relevant given the fact that /doall/ won't return until *all* futures are realized. It's just an internal detail. I finally fully grasped what you were saying...So yes you're right - as long as I'm

Re: pool-map - a more disciplined version of pmap on top of executors

2013-01-15 Thread Marko Topolnik
user= (def dummy-times [3000 10 9 8 7 6 5 4 3 2 1]) #'user/dummy-times user= (time (pmap #(do (Thread/sleep %) %) dummy-times)) Elapsed time: 16.213366 msecs (3000 10 9 8 7 6 5 4 3 2 1);;here you waited 3s before sleeping for 0.01 s user= (time (pool-map #(do (Thread/sleep %) %)

Re: a join function that can be used in a reduce

2013-01-15 Thread JM Ibanez
Hi Andrew, On Tuesday, January 15, 2013 at 10:23 AM, Andrew Xue wrote: Hi -- Building some generic joining functionality on top of cascalog, the clojure package for big data. I have a join function that is defined like this: (defn join [lhs rhs join-ons] ..implementation ...)

Re: pool-map - a more disciplined version of pmap on top of executors

2013-01-15 Thread Jim foo.bar
On 15/01/13 12:57, Marko Topolnik wrote: The tasks are waiting in the queue, they are not being executed at all. And the time they spend waiting cannot theoretically be a function of the time they will take to execute, once they get their chance. a so Java Futures are not the same as

Re: [ANN] nrepl-transcript

2013-01-15 Thread Bob Hutchison
On 2013-01-14, at 3:58 PM, Jonas jonas.enl...@gmail.com wrote: Hi I created a middleware for nrepl that saves a transcript of your repl interactions so you can go back and see what you did. https://github.com/jonase/nrepl-transcript Feedback welcome! Oh! Thank you! Bob Jonas

Re: CLJS: undefined and nil are equally nil?

2013-01-15 Thread David Nolen
This is an unrelated issue. We could probably simulate this by creating a Unbound type and initializing def'ed vars without init expressions to instances of it. David On Tue, Jan 15, 2013 at 1:08 AM, Frank Siebenlist frank.siebenl...@gmail.com wrote: ClojureScript:cljs.user (def a nil) nil

Re: pool-map - a more disciplined version of pmap on top of executors

2013-01-15 Thread Marko Topolnik
so Java Futures are not the same as Clojure futures then! A Clojure future will fire up as soon as you define it yes? If what you say is true, then Java Future objects are not the same! I was under the impression that as soon as you submit the job and get the Future Object back , the

Re: pool-map - a more disciplined version of pmap on top of executors

2013-01-15 Thread Jim foo.bar
On 15/01/13 13:49, Marko Topolnik wrote: It's not about futures, but about the way the ExecutorService is configured. Clojure's /future-call/ apparently uses the /agent send-off pool/, which is an unbounded thread pool executor. So you can use the same thing with

Re: pool-map - a more disciplined version of pmap on top of executors

2013-01-15 Thread Marko Topolnik
(defn pool-map A saner, more disciplined version of pmap. Submits jobs eagerly but polls for results lazily. Don't use if original ordering of 'coll' matters. [f coll] (let [exec (Executors/newCachedThreadPool) pool (ExecutorCompletionService. exec) futures (doall

Re: pool-map - a more disciplined version of pmap on top of executors

2013-01-15 Thread Marko Topolnik
*Executors/newCachedThreadPool* works exactly as I 'd want without the risk of overwhelming the system with threads (which the fixed-size pool will if I initialize it with (count coll))... You will either ovewhelm the system with threads or have the tasks waiting in the queue, there is

Re: ANN: bouncer, validation library for clojure

2013-01-15 Thread Gary Johnson
Right, I was testing against 1.5.0-RC1 and 1.5.0-RC2. Same problem occurred both times. I should have reported that in my initial bug report. Sorry about that. Also, thanks for the quick turnaround. I'll pull it and test it out. ~Gary On Monday, January 14, 2013 7:16:29 PM UTC-5, Leonardo

Re: CLJS: undefined and nil are equally nil?

2013-01-15 Thread Frank Siebenlist
I opened issue CLJS-457 for this enhancement/bug. As a workaround, one can test for undefined?, although that is not really the same and cljs-specific, but for my use case that will do. Thanks, Frank. On Jan 15, 2013, at 5:32 AM, David Nolen dnolen.li...@gmail.com wrote: This is an

Re: ANN: bouncer, validation library for clojure

2013-01-15 Thread Gary Johnson
Worked like a charm. Thanks. On Tuesday, January 15, 2013 12:33:26 PM UTC-5, Gary Johnson wrote: Right, I was testing against 1.5.0-RC1 and 1.5.0-RC2. Same problem occurred both times. I should have reported that in my initial bug report. Sorry about that. Also, thanks for the quick

[ANN] Leiningen 2.0.0-RC2

2013-01-15 Thread Phil Hagelberg
Hello good people of Clojure. This weekend we had the pleasure of releasing the second release candidate for Leiningen 2.0.0. There was an RC1 release a bit before that which contained a number of bugs that have been fixed too, but if you're currently using a preview release of Leiningen it

Re: CLJS: undefined and nil are equally nil?

2013-01-15 Thread David Nolen
Thanks, will look into it. On Tue, Jan 15, 2013 at 12:33 PM, Frank Siebenlist frank.siebenl...@gmail.com wrote: I opened issue CLJS-457 for this enhancement/bug. As a workaround, one can test for undefined?, although that is not really the same and cljs-specific, but for my use case that

Re: Standardized value for no-value?

2013-01-15 Thread Herwig Hochleitner
There actually is a standardized value for no value in clojure: nil The reason it's not useable as such in some places, is exactly it being standardized. Were we to introduce another such non-value, e.g. #blackhole, I think the following would happen: - people would be horribly confused on

can not get session with Ring and Compojure

2013-01-15 Thread larry google groups
I am not sure if this is a Ring problem or a Compojure problem. I set up my app as you see below. However, when I go to /, I have the function do this: (prn (apply str request)) and I see a great deal of information printed out at the terminal, but no session is set. What am I doing wrong? How

Re: Standardized value for no-value?

2013-01-15 Thread David Nolen
Using `undefined?` for anything other than JS interop is not recommended. I don't see any issues with: (def foo (atom ::uninitialized)) For your watcher case. On Mon, Jan 14, 2013 at 11:25 PM, Frank Siebenlist frank.siebenl...@gmail.com wrote: Ok - ClojureScript has an undefined? function

Re: Standardized value for no-value?

2013-01-15 Thread Stan Dyck
On 01/15/2013 11:48 AM, Herwig Hochleitner wrote: There actually is a standardized value for no value in clojure: nil The reason it's not useable as such in some places, is exactly it being standardized. Were we to introduce another such non-value, e.g. #blackhole, I think the following would

blank? implementation

2013-01-15 Thread Thomas
Hi all, In Stuart Halloway's book (Programming Clojure) is a wonderful example of the succinctness of Clojure where he compares the Apache Commons implementation of the isBlank method ( http://commons.apache.org/lang/api-2.5/src-html/org/apache/commons/lang/StringUtils.html#line.227) with a

Re: blank? implementation

2013-01-15 Thread Thomas
I think I just answered my own question... user= (time (dotimes [n 2] (s-blank? asdf))) Elapsed time: 2481.018 msecs nil user= (time (dotimes [n 2] (blank? asdf))) Elapsed time: 14.347 msecs nil user= Quite a difference I have to say. Thomas -- You received this message because you

Re: blank? implementation

2013-01-15 Thread Herwig Hochleitner
When you find non-idiomatic code in clojure's impl, the reason is almost always performance. In this case the clojure.string version is more performant since it saves: 1) the allocation of a lazy seq over the characters of the string 2) the allocation of a java.lang.Character for every char in the

Re: blank? implementation

2013-01-15 Thread Raoul Duke
Quite a difference I have to say. well, you can still be happy that first, get it right. then, make it fast is still easier in clojure than in java! (of course if, like me, you are a static typing bigot, there's more to be said on that :-) -- You received this message because you are

Re: blank? implementation

2013-01-15 Thread Marko Topolnik
On Tuesday, January 15, 2013 9:35:07 PM UTC+1, Thomas wrote: I think I just answered my own question... user= (time (dotimes [n 2] (s-blank? asdf))) Elapsed time: 2481.018 msecs nil user= (time (dotimes [n 2] (blank? asdf))) Elapsed time: 14.347 msecs nil user= Quite a

Re: blank? implementation

2013-01-15 Thread Ben Wolfson
Note that the two functions aren't actually equivalent, since the blank? that uses every? will accept anything that can be made a seq, while the blank? in clojure.string does not. Given an annotation like this, and assuming that every? is clojure.core/every? (defn blank? [^CharSequence s]

Re: blank? implementation

2013-01-15 Thread Marko Topolnik
Given an annotation like this, and assuming that every? is clojure.core/every? (defn blank? [^CharSequence s] (every? #(Character/isWhitespace %) s)) it seems as if it should be possible for the compiler to generate the faster code. Yes, there is enough information for a compiler

[ANN] Formative - render, parse, and validate web forms

2013-01-15 Thread Justin Kramer
Formative is a library for dealing with web forms. Features: - Describe forms using simple data - Render forms via pluggable renderers (comes with Bootstrap and other renderers built-in) - Parse submitted form data from Ring params - Validate parsed data using Verily

Re: ANN: bouncer, validation library for clojure

2013-01-15 Thread Leonardo Borges
Excellent. I'll push 0.2.2 final to clojars soon - as soon as I get the ANN email out. Thanks for the help. Cheers Leonardo Borges www.leonardoborges.com On Wed, Jan 16, 2013 at 4:37 AM, Gary Johnson gwjoh...@uvm.edu wrote: Worked like a charm. Thanks. On Tuesday, January 15, 2013

[ANN] bouncer 0.2.2 released

2013-01-15 Thread Leonardo Borges
bouncer is a validation DSL for Clojure apps Github: https://github.com/leonardoborges/bouncer Clojars: https://clojars.org/bouncer Highlights of version 0.2.2: - Use of a qualified keyword for storing the validation results - The defvalidator macro allows defining validators with an arbitrary

Re: blank? implementation

2013-01-15 Thread Leonardo Borges
This is interesting. We can get quite a huge performance boos by type hinting that impl. Times on my system running Clojure 1.4.0: user= (defn s-blank? [s] (every? #(Character/isWhitespace %) s)) user= (time (dotimes [n 2] (s-blank? asdf))) Elapsed time: 247.252 msecs Now if we type hint

Re: Better ways of documenting functions with type information?

2013-01-15 Thread Stephen Compall
On Sun, 2013-01-13 at 19:03 +0100, Marcel Möhring wrote: Currently I am using this approach but it feels rather clumsy: Takes a screen and a pixel coordinate and returns a map of maps with pixel colors and adjusted pixel coordinates around the pixel. Directions are degree

[ANN] tracer, trace your clojure function call stack

2013-01-15 Thread James Xu
https://github.com/xumingming/tracer tracer trace clojure call stack. When I read some open source clojure source code, I find that some function/logic are so complex that it is not so easy to understand the whole logic, I think it will help me a lot if I can see the real function call stack

Error on redirect when attempting unauthorized entry to Friend route

2013-01-15 Thread larry google groups
I have the following setting up an app where some pages will be protected by Friend. (defroutes app-routes (GET / request (index request)) (GET /search-results request (search-results request)) (GET /account request (friend/authorize #{::user} (account request))) (GET /admin request

Re: Error on redirect when attempting unauthorized entry to Friend route

2013-01-15 Thread larry google groups
Reading here: https://github.com/cemerick/friend I see this: (Note that Friend itself requires some core Ring middlewares: params, keyword-params and nested-params. I did not have nested-params so I will add this. This might be a stupid question, but why doesn't Friend include the Ring

Re: Error on redirect when attempting unauthorized entry to Friend route

2013-01-15 Thread larry google groups
Looking here: https://github.com/cemerick/friend/blob/master/src/cemerick/friend.clj I see in the stacktrace that the problem seems to be with the last line of this function: (defn default-unauthenticated-handler [request] (- request ::auth-config :login-uri

Re: Error on redirect when attempting unauthorized entry to Friend route

2013-01-15 Thread larry google groups
For anyone else who might make the same mistake I did, I changed this: (GET /admin request (friend/authorize #{::admin} (admin request))) to this: (GET /admin request (friend/authorize #{::admin} {} (admin request))) adding an empty map before the string that is my actual HTML page. That

Re: Clojure web server benchmarks

2013-01-15 Thread Peter Taoussanis
This is very interesting. Have you tried running the Ring Jetty adapter with a larger thread pool? It's set lower than the default so as not to overload cloud hosts like Heroku. Okay, bumped the :max-threads from 50 to 100 without seeing much change to the results at these relatively low

Re: [ANN] tracer, trace your clojure function call stack

2013-01-15 Thread Alex Baranosky
Curious: how's this different from tools.trace? On Tue, Jan 15, 2013 at 8:29 PM, James Xu xumingming64398...@gmail.comwrote: https://github.com/xumingming/tracer tracer trace clojure call stack. When I read some open source clojure source code, I find that some function/logic are so

Re: [ANN] tracer, trace your clojure function call stack

2013-01-15 Thread James Xu
Actually the same purpose, don't know there is such a tool before I wrote itŠ |o| From: Alex Baranosky alexander.barano...@gmail.com Reply-To: clojure@googlegroups.com Date: Tue, 15 Jan 2013 22:58:42 -0800 To: clojure@googlegroups.com Subject: Re: [ANN] tracer, trace your clojure function