Re: Clojure Performance For Expensive Algorithms

2013-02-23 Thread Mark Engelberg
On Fri, Feb 22, 2013 at 7:47 PM, Korny Sietsma ko...@sietsma.com wrote: Isn't that always the way, though? Build your program in a powerful, expressive language, then profile it, find the critical parts, and optimise them - where possible in the same language, and where that's too

Re: Clojure Performance For Expensive Algorithms

2013-02-23 Thread Marko Topolnik
I tend to think clojure is in a similar position - fast enough for the vast majority of things (ymmv of course - depending on what your domain is) and if you meet a situation like this where optimising the clojure becomes too ugly, you can drop down to Java (or indeed C!) Not quite, I'd

Re: Clojure Performance For Expensive Algorithms

2013-02-23 Thread Marko Topolnik
From my (admittedly limited) experience with Scala, yes, you can freely use reassignable local vars and write pretty much the same loops as in Java, but on the other hand there are many non-obvious performance pitfalls (like simply using the built-in *for comprehension*) and the optimized

protocol granularity

2013-02-23 Thread Jim - FooBar();
Hi everyone, I'm facing a little problem when extending protocols in a mix of inheriting and implementing classes...Let me explain: stanford-corenlp defines a top level interface called Annotator (with a single 'annotatate' method signature'). It also defines a class called

creating code stubs to use inside an extend-protocol form

2013-02-23 Thread Jim - FooBar();
I seem to be unable to quote a form and then repeatedly pass it inside the extend-protocol macro...something like this: (def ^:private co-stub '(run [this ^String text] (let [ann (edu.stanford.nlp.pipeline.Annotation. text)] (.annotate this ann) ann))) (extend-protocol IComponent

Re: Clojure Performance For Expensive Algorithms

2013-02-23 Thread David Nolen
Lisp programmers know the value of everything and the cost of nothing ;) On Saturday, February 23, 2013, Marko Topolnik wrote: I tend to think clojure is in a similar position - fast enough for the vast majority of things (ymmv of course - depending on what your domain is) and if you meet a

datomic + clojure + clojurescript examples

2013-02-23 Thread Mond Ray
My fellow Clojurians, I am having a trouble hunting down an example of the above stack for clojure applications. Can anyone point me in the right direction? Thanks Ray -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send

Re: nREPL + Emacs: How to get new definitions to load reliably?

2013-02-23 Thread Stuart Sierra
Hi Karl, I've added an experimental feature in tools.namespace 0.2.3-SNAPSHOT which tries to recover the namespace configuration in your REPL after an error during reload. What that hopefully means is you can call `refresh` as you normally would even after an error. Updated docs

Re: Clojure Performance For Expensive Algorithms

2013-02-23 Thread Marko Topolnik
:) On the other hand, the Common Lisp movement of the '80s was brimming with the can-do attitude of achieving native performance. From Steele, Gabriel, *The Evolution of Lisp*: the two strongest voices—Steele and Gabriel—were feeling their oats over their ability to write a powerful compiler

Re: Redefinition of datatypes

2013-02-23 Thread Stuart Sierra
Hi Ambrose, I would try to help diagnose this, but I can't even try to compile core.typed in its present state because of dependencies: core.typed declares a dependency on analyze 0.3.1-SNAPSHOThttps://github.com/clojure/core.typed/blob/78d09859cee78967e9dd0ee7d74e0f52bd3be6f1/project.clj#L3,

Re: Redefinition of datatypes

2013-02-23 Thread Ambrose Bonnaire-Sergeant
Hi Stuart, Sorry about that, I just changed it to analyze 0.3.0, which is on Clojars. Try pulling again. As for dependencies: - the Trammel dep could be refactored to use core.contracts - I'm happy to offer analyze as a contrib project if needed. It's crucial to core.typed. - other deps can be

Re: A Working nrepl-ritz Setup?

2013-02-23 Thread bruce li
Hello, I managed to get nrepl-ritz going, but I'm experiencing the following annoying things: 1. When I switched on M-x nrepl-ritz-break-on-exception, I'm unable to disable it. When I called the command with a prefix(by default M--), it is still in action. Is there a way to disable it?

Re: Redefinition of datatypes

2013-02-23 Thread Chas Emerick
On Feb 23, 2013, at 11:35 AM, Stuart Sierra wrote: Furthermore, according to the policy of the Maven Central Repository, we cannot deploy anything which depends on third-party repositories. Therefore we cannot deploy core.typed to the Central Repository unless all its dependencies are also

Re: Clojure Performance For Expensive Algorithms

2013-02-23 Thread Marko Topolnik
Stack analysis is quite a brittle mechanism, as far as I'm aware of. As soon as you pass the object to any method, even if private, the object will not be stack-allocated. The way Clojure code is typically written, and the way it is compiled, some method call will almost certainly get involved.

Re: Can't type-hint a def with ^objects

2013-02-23 Thread Michael Klishin
2013/2/24 Marko Topolnik marko.topol...@gmail.com Is this behavior specified? It certainly doesn't make sense from a language user perspective. ^doubles can be used to avoid boxing on the hot code path, what would you gain with ^objects? -- MK http://github.com/michaelklishin

Re: Can't type-hint a def with ^objects

2013-02-23 Thread Marko Topolnik
Actually, ^doubles can be used for two separate things, one of which applies to ^objects as well: avoid reflection and avoid boxing/unboxing. I do need to avoid reflection. On Saturday, February 23, 2013 10:00:58 PM UTC+1, Michael Klishin wrote: 2013/2/24 Marko Topolnik marko.t...@gmail.com

[ANN] edn-java 0.4.0 a library to read and write edn data

2013-02-23 Thread Ben Smith-Mannschott
I'm happy to report that edn-java is now available on Maven Central. What is edn-java? - Edn-java is a Java library for reading and writing edn data. It has no dependencies other than Java 1.6.x or later. A more detailed description, including usage examples is available here:

How does clj-http work regarding https?

2013-02-23 Thread larry google groups
This might be a dumb How does the Internet work kind of question. I have been asked to pull data from Omniture, using the Omniture API. I thought this would take me an hour, but I've been working on this for 3 days now. I keep getting authentication errors. I became curious about exactly what

Re: Can't type-hint a def with ^objects

2013-02-23 Thread Michael Klishin
2013/2/24 Marko Topolnik marko.topol...@gmail.com I do need to avoid reflection. Then use ^[Ljava.lang.Object; and friends, it works just fine. -- MK http://github.com/michaelklishin http://twitter.com/michaelklishin -- -- You received this message because you are subscribed to the Google

Re: Can't type-hint a def with ^objects

2013-02-23 Thread Marko Topolnik
Thank you, I'm using it and it does work. However, there is presumably a good reason for the existence of the ^objects annotation, so the question remains whether this is a) specified behavior and b) the way it is planned to stay. On Saturday, February 23, 2013 10:32:31 PM UTC+1, Michael

Re: How does clj-http work regarding https?

2013-02-23 Thread larry google groups
When I turn on: :debug true :debug-body true I get all that follows. Which mostly looks right, I guess. But why don't I see the headers in Charles? I'll go back to assuming this is a problem with Omniture, but I would be grateful if anyone could glance over this output and tell me if anything

Re: Clojure Performance For Expensive Algorithms

2013-02-23 Thread Geo
Just wanted to say I am getting a lot out of this discussion. -- -- 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

Re: How does clj-http work regarding https?

2013-02-23 Thread Jonah Benton
Try adding :insecure? true to the map. Charles dynamically generates a cert pretending to be the target host when acting as an ssl proxy, and clj-http probably has to be told to accept it. On Sat, Feb 23, 2013 at 4:18 PM, larry google groups lawrencecloj...@gmail.com wrote: This might be

Re: How does clj-http work regarding https?

2013-02-23 Thread larry google groups
Try adding :insecure? true to the map. Charles dynamically generates a cert pretending to be the target host when acting as an ssl proxy, and clj-http probably has to be told to accept it. Okay, I've done so, but I don't think I understand what you are telling me. Are you saying that

functions as return values

2013-02-23 Thread Larry Travis
In Clojure, if I have a function call that asks for return of a function, for example user ((fn [a] (fn [b] (+ (inc a) (* b b 5) I get the function name #user$eval4164$fn__4165$fn__4166 user$eval4164$fn__4165$fn__4166@29770daa But what I would like to get is an expression that defines

Re: How does clj-http work regarding https?

2013-02-23 Thread larry google groups
Any idea why a single call to clj-http/post causes 4 transactions to appear in Charles? On Feb 23, 5:47 pm, larry google groups lawrencecloj...@gmail.com wrote: Try adding :insecure? true to the map. Charles dynamically generates a cert pretending to be the target host when acting as

Re: How does clj-http work regarding https?

2013-02-23 Thread Jonah Benton
Ok- so in Charles, you'll need to do that, tell it to ssl proxy the domain api2.omniture.com Described in a little more detail here: http://www.charlesproxy.com/documentation/proxying/ssl-proxying/ On Sat, Feb 23, 2013 at 5:47 PM, larry google groups lawrencecloj...@gmail.com wrote:

Re: How does clj-http work regarding https?

2013-02-23 Thread Jonah Benton
Very likely it's the automatic retry logic: ;; Apache's http client automatically retries on IOExceptions, if you;; would like to handle these retries yourself, you can specify a;; :retry-handler. Return true to retry, false to stop trying:(client/post http://example.org; {:multipart [[title Foo]

Re: How does clj-http work regarding https?

2013-02-23 Thread larry google groups
Very likely it's the automatic retry logic: Thank you for that. One mystery solved. I wonder why it retries? The ping reaches Omniture, I get back a 401 error. Maybe it retries on any 4xx error? On Feb 23, 6:30 pm, Jonah Benton jo...@jonah.com wrote: Very likely it's the automatic retry

Re: How does clj-http work regarding https?

2013-02-23 Thread larry google groups
Described in a little more detail here: http://www.charlesproxy.com/documentation/proxying/ssl-proxying/ Thank you, that is a huge help. I am finding it is a real headache to use several new technologies, all at once. On Feb 23, 6:28 pm, Jonah Benton jo...@jonah.com wrote: Ok- so in

Re: How does clj-http work regarding https?

2013-02-23 Thread larry google groups
;; Apache's http client automatically retries on IOExceptions, I guess clj-http swallows the exception? It seems strange that it doesn't bubble up to my code. But then I don't know Java so I probably miss some of the etiquette about when a library should catch its own exceptions. On Feb 23,

Re: Clojure Performance For Expensive Algorithms

2013-02-23 Thread Leif
This may be slightly off topic, but your longest contiguous common subsequence problem sounds like the longest common substring problem. Your code uses the dynamic programming solution, which is O(M*N), but there are O(M+N) algorithms that might be faster depending on the length and alphabet

Re: How does clj-http work regarding https?

2013-02-23 Thread Jonah Benton
It won't retry on http-level errors; those semantics are up to the application. It should only retry connection-layer problems. So there must have been something funny happening either between the client and Charles, or between Charles and Omniture. On Sat, Feb 23, 2013 at 6:50 PM, larry google

Re: How does clj-http work regarding https?

2013-02-23 Thread Jonah Benton
If you cut Charles out of the picture and just send your payload directly to Omniture over https, how does Omniture respond? On Sat, Feb 23, 2013 at 6:52 PM, larry google groups lawrencecloj...@gmail.com wrote: Described in a little more detail here:

Re: Clojure Performance For Expensive Algorithms

2013-02-23 Thread Geo
It is in fact the longest common substring problem, but applied to words in a text rather than characters in a string, hence the algorithm operates on arrays of strings. I am aware of the O(M+N) algorithm, but it involves suffix trees with which I am unfamiliar and don't want to spend the time

Re: nREPL + Emacs: How to get new definitions to load reliably?

2013-02-23 Thread Karl Smeltzer
I've added an experimental feature in tools.namespace 0.2.3-SNAPSHOT which tries to recover the namespace configuration in your REPL after an error during reload. What that hopefully means is you can call `refresh` as you normally would even after an error. I really appreciate you working on

Re: functions as return values

2013-02-23 Thread Larry Travis
I am afraid I didn't ask my question clearly. Michael's solution would give as output (fn [b] (+ (inc a) (* b b))) What I want as output is (fn [b] (+ 6 (* b b))) ... where those expressions within the inner-lambda scope (of the original nested-lambda expression) that can be evaluated

Re: functions as return values

2013-02-23 Thread AtKaaZ
= ((fn [a] (backtick/template (fn [b] (+ ~(inc a) (* b b))) ) ) 5) (fn [b] (+ 6 (* b b))) https://github.com/brandonbloom/backtick = (eval ((fn [a] (backtick/template (fn [b] (+ ~(inc a) (* b b))) ) ) 5)) #funxions$eval3145$fn__3146 util.funxions$eval3145$fn__3146@4a7c5889 = ((eval ((fn [a]

suggest to have defn/new/throw/etc.. allow evaluating ...maybe?

2013-02-23 Thread AtKaaZ
= *(defn (symbol (str a b)) [x] x)* IllegalArgumentException First argument to defn must be a symbol clojure.core/defn (core.clj:277) maybe allow ~ like this: =* (defn ~(symbol (str a b)) [x] x)* IllegalArgumentException First argument to defn must be a symbol clojure.core/defn (core.clj:277) to

Re: creating code stubs to use inside an extend-protocol form

2013-02-23 Thread AtKaaZ
(defprotocol XmlNode (as-xml [this])) (defrecord User [^Integer id ^String name ^java.util.Date dob]) (def a '(as-xml [this] (str this))) (eval (backtick/template (extend-protocol XmlNode Integer ~a ))) I've no experience with these, so that's off the top of my head... backtick is