Re: [ANN] Nginx-Clojure v0.2.2 released

2014-06-02 Thread Toni Helenius
Out of interest, how do people use these multiprocess server thingies like nginx-clojure or vert.x with datomic? On Saturday, May 31, 2014 7:57:54 PM UTC+3, Xfeep Zhang wrote: > > Nginx-Clojure is a Nginx module for embedding Clojure > or Java programs, typically those Ring

protocol order

2014-06-02 Thread Phillip Lord
How does Clojure decide which Protocol implementation to call. I ask because I have tried this code: (defprotocol Fred (fred [item])) (extend-type CharSequence Fred (fred [item] "charseq")) (extend-type Comparable Fred (fred [item] "comparable")) (extend-type java.io.Serializable

Re: protocol order

2014-06-02 Thread Timothy Baldridge
>From clojure.org/protocols : " if one interface is derived from the other, the more derived is used, else which one is used is unspecified." Since multi-methods use "isa?" and not "=" perhaps use multi-methods and specify order via "prefer-method"? Timothy On Mon, Jun 2, 2014 at 6:57 AM, Phi

Re: [ANN] Clojure cheatsheet with search capability

2014-06-02 Thread John Gabriele
On Sunday, June 1, 2014 5:15:52 PM UTC-4, Andy Fingerhut wrote: > > Thanks to Francois du Toit, the versions of the Clojure cheatsheet > available at the link below now have the ability to let you search for all > symbols beginning with a string you type in, with color highlighting of > matches.

Re: [ANN] Clojure cheatsheet with search capability

2014-06-02 Thread Andy Fingerhut
I'm open to a change like that. If anyone has a code change that would implement that, please let me know. Andy On Mon, Jun 2, 2014 at 6:54 AM, John Gabriele wrote: > On Sunday, June 1, 2014 5:15:52 PM UTC-4, Andy Fingerhut wrote: >> >> Thanks to Francois du Toit, the versions of the Clojure

Re: protocol order

2014-06-02 Thread Phillip Lord
Timothy Baldridge writes: >>From clojure.org/protocols : " > > if one interface is derived from the other, the more derived is used, else > which one is used is unspecified." Oh dear, that's not so hot. I guess it's the first that gets tested, and that this is undefined. > Since multi-method

Re: help with the lawyers?

2014-06-02 Thread gla
Tempest in a teapot. The Federal Government is rarely held to state laws under diversity under the Erie Doctrine. The probability of the Fed being held to NYS law is minimal to nil. Second the Arbitration clause is permitted under the Administrative Dispute Resolution Act. Under that act

Re: REPL using Emacs Cider

2014-06-02 Thread Erlis Vidal
Hi Timur, I've seen weird errors when not using lein2. What version of lein are you using? On Sun, Jun 1, 2014 at 11:52 AM, Timur wrote: > hi everyone, I have a question about using nREPL (cider) in Emacs. > > In my clojurescript project, I start the repl server using cider-jack-in > command.

Re: Top-down code in namspaces

2014-06-02 Thread Sean Corfield
On Jun 1, 2014, at 11:53 PM, u1204 wrote: > Instead of calling load to read the file, call your tangle function. Whilst that might work from the REPL, it's not going to work with normal Clojure tooling and it would mean you couldn't just :require files written that way in the file's ns either.

Code Mesh London 4-5 Nov - VEB opens

2014-06-02 Thread Andra Dinu
Hi all, For the third year in a row, Code Mesh London will be the best place in Europe to meet over 50 inventors and commercial users of innovative tech and non-mainstream languages. Among the first speakers on the website: Data-Centric Functional Programmer and O'Reilly Author Dean Whampler,

Re: What's clojure killer app? I don't see any.

2014-06-02 Thread douglas smith
I would like to revisit this thread on 'killer-apps' for clojure. Hope you don't mind. For quite some time I have been trying to teach myself to code. -even before clojure was 'born'. (slow learner?... probably) I have read many books and spent many hours 'dinking' as my wife says. I find

stack backtraces for exceptions in agents?

2014-06-02 Thread Lee Spector
In my single-threaded code, exceptions stop execution and print a stack backtrace. This is less informative than I would like [1], but sometimes it provides crucial clues. My multi-threaded code generally uses agents (just because that's the best way I've found to get something that behaves li

Re: stack backtraces for exceptions in agents?

2014-06-02 Thread Sean Corfield
The exception object should have a full stack trace in it - how are you printing your exceptions? Sean On Jun 2, 2014, at 12:28 PM, Lee Spector wrote: > In my single-threaded code, exceptions stop execution and print a stack > backtrace. This is less informative than I would like [1], but some

Re: stack backtraces for exceptions in agents?

2014-06-02 Thread Lee Spector
(fn [agnt except] (println except)) -Lee On Jun 2, 2014, at 3:38 PM, Sean Corfield wrote: > The exception object should have a full stack trace in it - how are you > printing your exceptions? > > Sean > > On Jun 2, 2014, at 12:28 PM, Lee Spector wrote: >> In my single-threaded code, exce

Re: stack backtraces for exceptions in agents?

2014-06-02 Thread Andy Fingerhut
Try out (clojure.repl/pst e 1000), where e is the exception you have caught. Andy On Mon, Jun 2, 2014 at 12:28 PM, Lee Spector wrote: > > In my single-threaded code, exceptions stop execution and print a stack > backtrace. This is less informative than I would like [1], but sometimes it > prov

Re: stack backtraces for exceptions in agents?

2014-06-02 Thread Lee Spector
Beautiful. In fact, if I specify an :error-handler of: (fn [agnt except] (clojure.repl/pst except 1000) (System/exit 0)) Then it prints the backtrace and also terminates execution. FWIW that would seem to me to be a better default than the current "fail silently." -Lee On Jun 2, 2014, at

Re: stack backtraces for exceptions in agents?

2014-06-02 Thread Lee Spector
PS I should have said "thanks!". -Lee On Jun 2, 2014, at 3:52 PM, Lee Spector wrote: > > Beautiful. > > In fact, if I specify an :error-handler of: > > (fn [agnt except] (clojure.repl/pst except 1000) (System/exit 0)) > > Then it prints the backtrace and also terminates execution. > > FW

non-lazy clojure?

2014-06-02 Thread Lee Spector
I've generally liked Clojure's pervasive laziness. It's cute and it sometimes permits lovely, elegant approaches to particular programming problems. And although I've long known that it can get you into trouble in a few unusual cases -- I think I recall seeing a nice blog post on issues related

Re: non-lazy clojure?

2014-06-02 Thread Softaddicts
mapv a bit shorter :) Luc P. > > I've generally liked Clojure's pervasive laziness. It's cute and it sometimes > permits lovely, elegant approaches to particular programming problems. And > although I've long known that it can get you into trouble in a few unusual > cases -- I think I recall

RE: non-lazy clojure?

2014-06-02 Thread Phillip Lord
Funny, I posted an article of my Clojure gotcha's today (http://www.russet.org.uk/blog/2991), and this is one of them. I've also had very nasty bugs, in addition to the general hassle of wrapping a Java API which works through side-effects. I created a few functions covering the most common one

Re: non-lazy clojure?

2014-06-02 Thread Jozef Wagner
Reducers [1] provide eager variants of some core seq functions (map, filter, etc.). Note that they do not cache the result, so they recompute it every time you use their result. [1] http://clojure.org/reducers On Mon, Jun 2, 2014 at 10:32 PM, Lee Spector wrote: > > I've generally liked Clojure

4Clojure exercise 47 question

2014-06-02 Thread Erlis Vidal
Hi guys, Quick question about exercise 47, http://www.4clojure.com/problem/47 Here you could find the following *(not (contains? '(1 2 4) __)* If I try to execute it in my REPL it gives the following error: * contains? not supported on type: clojure.lang.PersistentList* Was this a change of

Re: non-lazy clojure?

2014-06-02 Thread Lee Spector
On Jun 2, 2014, at 4:51 PM, Softaddicts wrote: > mapv > > a bit shorter :) > > Luc P. Thanks Luc. I have indeed migrated to mapv for many cases and I could have for the specific final fix for the example I posted. But there are lots of other "fixes" that I made earlier in the same project,

Advice on implementing atomic read/write socket operations

2014-06-02 Thread Joachim De Beule
Dear group, I have the following use case: I have a socket connection to an external service. I want several threads to use the same connection. Importantly, in order to get a synchronized response from the external service, every write must be followed by a read before another write is perfo

Re: non-lazy clojure?

2014-06-02 Thread Lee Spector
On Jun 2, 2014, at 4:52 PM, Phillip Lord wrote: > Funny, I posted an article of my Clojure gotcha's today > (http://www.russet.org.uk/blog/2991), and this is one of them. I've also had > very nasty bugs, in addition to the general hassle of wrapping a Java API > which works through side-effec

Re: non-lazy clojure?

2014-06-02 Thread Lee Spector
On Jun 2, 2014, at 4:52 PM, Jozef Wagner wrote: > Reducers [1] provide eager variants of some core seq functions (map, filter, > etc.). Note that they do not cache the result, so they recompute it every > time you use their result. > > [1] http://clojure.org/reducers Thanks Josef. I haven't

Re: 4Clojure exercise 47 question

2014-06-02 Thread Stephen Gilardi
On Jun 2, 2014, at 4:53 PM, Erlis Vidal wrote: > Hi guys, > > Quick question about exercise 47, http://www.4clojure.com/problem/47 > > Here you could find the following > > (not (contains? '(1 2 4) __) > > If I try to execute it in my REPL it gives the following error: > > contains? not

Re: Advice on implementing atomic read/write socket operations

2014-06-02 Thread James Reeves
Since two threads cannot use the connection concurrently, it sounds like you just need the locking macro: (locking conn (.write conn "blah") (.read conn)) - James On 2 June 2014 22:15, Joachim De Beule wrote: > Dear group, > > I have the following use case: I have a socket con

Is it the right Clojure group for a newbie

2014-06-02 Thread sharmabha
All, If this is the right Clojure group for a newbie, I would like to ask for the best online resources to begin with. I am new to programming, having recently switched from a non technical field. I have started looking at http://www.braveclojure.com/, but any pointers would be useful, especi

Re: Is it the right Clojure group for a newbie

2014-06-02 Thread Gary Trakhman
Check out the 'online resources' section: http://clojure.org/getting_started On Mon, Jun 2, 2014 at 5:36 PM, wrote: > All, >If this is the right Clojure group for a newbie, I would like to ask > for the best online resources to begin with. I am new to programming, > having recently switched

Re: non-lazy clojure?

2014-06-02 Thread Gary Johnson
Hey Lee, I would second Jozef's suggestion that you look into using the reducers library when you need non-lazy sequence operations. Although a major motivation of Rich's work was clearly to enable easy parallel folding via fork/join, the fold function is only one of many in this library. Thi

Re: non-lazy clojure?

2014-06-02 Thread Lee Spector
Gary: That's compelling indeed, and I will look into it more! Thanks, -Lee PS would a call to vec do the same thing as "into []" here? On Jun 2, 2014, at 7:14 PM, Gary Johnson wrote: > Hey Lee, > > I would second Jozef's suggestion that you look into using the reducers > library when y

deskewing image

2014-06-02 Thread Glen Rubin
I am interested in automatically deskewing of a scanned image before ocr processing using tesseract. I found the following, which is some java code to do it http://anydoby.com/jblog/en/java/1990 Can anyone give some advice on how to make use of this java code using clojure? -- You received

Re: deskewing image

2014-06-02 Thread Atamert Ölçgen
On Tue, Jun 3, 2014 at 5:14 AM, Glen Rubin wrote: > I am interested in automatically deskewing of a scanned image before ocr > processing using tesseract. I found the following, which is some java code > to do it http://anydoby.com/jblog/en/java/1990 > > Can anyone give some advice on how to mak

Re: Is it the right Clojure group for a newbie

2014-06-02 Thread Linus Ericsson
Also check out Kyle Kingsbury's Clojure from the ground up: http://aphyr.com/posts/301-clojure-from-the-ground-up-welcome A lot of things in Clojure gets much easier when one understands a bit of java. Not how to write a for loop, but rather how to use various classes. I recommend the Oracle Java