Re: Clojure performance question

2014-03-02 Thread Shantanu Kumar
On Sunday, 2 March 2014 12:49:15 UTC+5:30, Shantanu Kumar wrote: On Sunday, 2 March 2014 05:32:00 UTC+5:30, bob wrote: Good point, Thanks a lot. Shall we improve the str fn in the core lib? From my point of view, the core fns should be performance sensitive. If string formation is

Re: Clojure performance question

2014-03-02 Thread Luc Prefontaine
I cannot agree with this... Not at 100% at least. String manipulations are frequent enough to mandate some tuning if the need is obvious. Looks to me that this is the case here. Other core fns went through rewrites to improve performance. Simplicity has nothing to do with internal

Re: Can't start repl with Leiningen

2014-03-02 Thread Matej Fröbe
I found the problem more or less. lein repl works if I set iptables rule: *#iptables -P INPUT ACCEPT* What I don't understand is, why it worked already in the past with these rules: *#iptables -P INPUT DROP#iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT*but now it doesn't.

[ANN] edn-java 0.4.4 released

2014-03-02 Thread Ben Smith-Mannschott
edn-java [1] is a parser and printer for edn [2]. This release: * Provides a pretty printer for edn data [3]. * Recognizes 'foo//' as a symbol [4]. * Provides experimental more readable, but still compact, edn printing [5]. It should be available on Maven Central within a day. [1]

Re: I want to get sha1 of a string

2014-03-02 Thread Ben Smith-Mannschott
(- Hello, World! .getBytes create-hash ...) Will get you the hash of the string encoded to bytes using *some random encoding*. (Whatever the platform you're currently running on defaults to.) You should explicitly choose an encoding and stick to it. I'd suggest UTF-8 since that can encode all

Re: I want to get sha1 of a string

2014-03-02 Thread action
ok,think you! 在 2014年3月2日星期日UTC+8上午12时28分25秒,JPH写道: I've had good experiences with https://github.com/xsc/pandect. You can also use Java interop like this: https://gist.github.com/prasincs/827272 JPH On 03/02/2014 12:26 AM, action wrote: do like this: (ns

I want to parse the POST body twice.

2014-03-02 Thread action
I want to parse the POST body twice, but in the second place: org.xml.sax.SAXParseException: Premature end of file. How should I clone the body render for the second parse? -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send

Re: case statement and java constants

2014-03-02 Thread Herwig Hochleitner
Created: http://dev.clojure.org/jira/browse/CLJ-1368 2014-03-01 2:58 GMT+01:00 Alex Miller a...@puredanger.com: I would appreciate a jira enhancement ticket for this. Alex -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group,

Re: I want to parse the POST body twice.

2014-03-02 Thread James Reeves
Depending on how large the input is, you could either read it all into memory (e.g. with slurp or similar), or dump it to a temporary file. - James On 2 March 2014 16:18, action actioncao2...@gmail.com wrote: I want to parse the POST body twice, but in the second place:

Re: I want to parse the POST body twice.

2014-03-02 Thread Herwig Hochleitner
Copy the body to a byte array or file before parsing (or while parsing it the first time, if you want to save latency). Your server doesn't do this, so that it can reuse a few small buffer chunks instead of allocating the whole content-length, while streaming the body into your application.

Re: case statement and java constants

2014-03-02 Thread Adam Clements
Oops, I already filed http://dev.clojure.org/jira/browse/CLJ-1367. Should probably link/mark as dupe - I don't appear to be able to do anything other than comment. Adam On Sun, Mar 2, 2014 at 4:35 PM, Herwig Hochleitner hhochleit...@gmail.comwrote: Created:

Re: [ANN] Sente - Clojure(Script) + core.async + WebSockets/Ajax

2014-03-02 Thread Mark
Hi Peter - I'm trying to learn Sente using the LightTable browser connected repl. I try to evaluate the following code: (let [{:keys [chsk ch-recv send-fn]} (sente/make-channel-socket! http://localhost:6100/chsk; ; Note the same URL as before {})] (def chsk chsk) (def

Re: I want to parse the POST body twice.

2014-03-02 Thread action
how to use slurp? first: (slurp body) and second reuse: (slurp body) 在 2014年3月3日星期一UTC+8上午12时44分09秒,James Reeves写道: Depending on how large the input is, you could either read it all into memory (e.g. with slurp or similar), or dump it to a temporary file. - James On 2 March 2014 16:18,

Re: case statement and java constants

2014-03-02 Thread Herwig Hochleitner
Oh sorry, I should have looked at the newest issues first. I don't think the tickets are dupes, because yours calls for enabling java static fields for case constants. Mine just wants to add language stating how case can be used right now. IMO enabling case constants is at odds with current doc

Re: I want to parse the POST body twice.

2014-03-02 Thread James Reeves
You can't consume an input-stream twice. You need to store the result somewhere. For example: (defn handler [request] (let [body-str (slurp (:body request))] (do-something-to body-str) (do-something-else-to body-str))) Be aware that in production you'll likely want to limit

Re: I want to parse the POST body twice.

2014-03-02 Thread Herwig Hochleitner
Don't slurp twice. Slurp mutates the stream by reading bytes off of it. Also, slurping an xml stream isn't a good idea, because the xml header can change the character encoding like so ?xml version=1.0 encoding=ISO-8859-1? Try (let [bufstream (doto (java.io.ByteArrayOutputStream.

Re: [ANN] Sente - Clojure(Script) + core.async + WebSockets/Ajax

2014-03-02 Thread Peter Taoussanis
Hi Mark, I'm trying to learn Sente using the LightTable browser connected repl. Ahh, nice. Haven't tried LightTable yet myself, but I'd think it should work okay. From the JS console, I see repeated, failed attempts to connect the server. The URL is what's tripping you up here. Is there a

Re: [ANN] Sente - Clojure(Script) + core.async + WebSockets/Ajax

2014-03-02 Thread Eduard Bondarenko
You are probably hit by CORS, try to open webpage at the same host http://localhost:6100/, see http://enable-cors.org/index.html Check Network tab in Chrome dev tools. Best regards, Eduard On Sun, Mar 2, 2014 at 7:16 PM, Mark markaddle...@gmail.com wrote: Hi Peter - I'm trying to learn

[ANN] Etsy API library for Clojure

2014-03-02 Thread Daniel Szmulewicz
Hi, Announcing an early release of a wrapper for the Etsy API in Clojure. https://github.com/danielsz/etsy-clojure-api Available from clojars.org. Please refer to the README for the details. Thank you. -- Daniel Szmulewicz -- You received this message because you are subscribed to the

Re: Clojure performance question

2014-03-02 Thread Timothy Baldridge
How are you running these tests? The correct way to benchmark such things is via a real benchmark framework (such as criterium) then compile your clojure app to a jar (perhaps via lein uberjar) and finally run it via a bare java invocation: java -jar my.jar. Lein for example sometimes uses

Re: [ANN] - purnam 0.4.3 released - Javascript Language Extensions for Clojurescript

2014-03-02 Thread Mark Mandel
Awesome. Glad to have this complete. I had some pending pull requests I wanted to drop in. Mark On Sun, Mar 2, 2014 at 8:22 AM, zcaudate z...@caudate.me wrote: I'm also looking for collaborators as it is getting to a stage where I'm having trouble managing it by myself. if anybody is

Re: Clojure performance question

2014-03-02 Thread Shantanu Kumar
On Monday, 3 March 2014 02:18:39 UTC+5:30, tbc++ wrote: How are you running these tests? The correct way to benchmark such things is via a real benchmark framework (such as criterium) then compile your clojure app to a jar (perhaps via lein uberjar) and finally run it via a bare java

clojure lazy-seq caching?

2014-03-02 Thread Andy Smith
Hi, I understand that lazy-seq caches the computed result as each element is read. However, how can is this made to be thread-safe? Andy -- 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

Re: use/require/import and quoted form

2014-03-02 Thread Andy Smith
Oh I see, so we are using exactly the right datatype for the purpose... thanks :o) -- 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

Re: [ANN] Sente - Clojure(Script) + core.async + WebSockets/Ajax

2014-03-02 Thread Mark
Yep, I was running into the two problems you pointed out: First, I needed to use a relative URL in make-channel-socket! and that necessitated delivering my HTML through http-kit rather than the shortcut of reading it from the file system using file://... Once I did that, an assertion nicely

Re: clojure lazy-seq caching?

2014-03-02 Thread Stephen C. Gilardi
I understand that lazy-seq caches the computed result as each element is read. However, how can is this made to be thread-safe? The caching is done within a synchronized method as each element's value is realized. There is an instance of clojure.lang.LazySeq that manages each seq element's

Re: [ANN] - purnam 0.4.3 released - Javascript Language Extensions for Clojurescript

2014-03-02 Thread Chris Zheng
Looking forward to it! On 03/03/2014, at 7:49, Mark Mandel mark.man...@gmail.com wrote: Awesome. Glad to have this complete. I had some pending pull requests I wanted to drop in. Mark On Sun, Mar 2, 2014 at 8:22 AM, zcaudate z...@caudate.me wrote: I'm also looking for

Re: Clojure performance question

2014-03-02 Thread Mikera
Some perspectives (as someone who has been tuning this stuff a lot, from a core.matrix standpoint in particular) On Saturday, 1 March 2014 13:02:26 UTC+8, bob wrote: Hi, Can I ask a newbie question about clojure performance? What make clojure performance slow than java?, it seems clojure

Re: Clojure performance question

2014-03-02 Thread bob
Cool, Kiss. From my 2 cent, the solid is important to the clojure, and the core team is making any change carefully, but looks to me that the `radical` idea is important to the community and clojure as well, might that we need a branch of clojure to do some `radical` attempt and experiment, it

New Functional Programming Job Opportunities

2014-03-02 Thread Functional Jobs
Here are some functional programming job opportunities that were posted recently: functional software developer at OpinionLab http://functionaljobs.com/jobs/8685-functional-software-developer-at-opinionlab Cheers, Sean Murphy FunctionalJobs.com -- You received this message because you

Re: [ANN] Sente - Clojure(Script) + core.async + WebSockets/Ajax

2014-03-02 Thread Peter Taoussanis
and that necessitated delivering my HTML through http-kit rather than the shortcut of reading it from the file system using file://... Yes, good catch - sorry, forgot to mention that. Once I did that, an assertion nicely documented the use of chsk-send! (thanks for that!). One