Re: Clojure performance question

2014-03-01 Thread bob
Case : clojure verison: (time (dotimes [n 1000] (str n another word))) ;; take about 5000msec java version long time = System.nanoTime(); for(int i=0 ; i1000 ;i++){ String a=i+another word; } System.out.println(System.nanoTime()-time);

Looking for a Rich Hickey quotation

2014-03-01 Thread Kashyap CK
Hi, In one of the talks, Rich Hickey had mentioned something to the effect - Programs are meant to state the intention of your computation to other programmers/humans - as opposed to instructions for a machine He was quoting someone else actually (perhaps Knuth). I just cant seem to get my

[Video] The case for Clojure

2014-03-01 Thread James Trunk
Hi everyone, I made a new video about Clojure that I wanted to share with you all. It's a sales pitch for choosing Clojure as the language for your next project: The case for Clojure http://youtu.be/NvxyTKyXSRg I realise that if you're reading this discussion group there's a good chance that

Re: Looking for a Rich Hickey quotation

2014-03-01 Thread t x
Thus, programs must be written for people to read, and only incidentally for machines to execute. -- http://mitpress.mit.edu/sicp/front/node3.html On Sat, Mar 1, 2014 at 2:48 AM, Kashyap CK ckkash...@gmail.com wrote: Hi, In one of the talks, Rich Hickey had mentioned something to the effect -

Re: ace / codemirror in cljs

2014-03-01 Thread Dave Sann
have you considered reading the LightTable code? There is probably some cljs and editor in there On Saturday, 1 March 2014 17:26:18 UTC+11, t x wrote: Hi, Is there anything like http://codemirror.net/ or http://ace.c9.io/#nav=about in cljs ? The goal is not to use

Re: Looking for a Rich Hickey quotation

2014-03-01 Thread Kashyap CK
Thank you so much, Regards, Kashyap On Saturday, March 1, 2014 4:27:05 PM UTC+5:30, t x wrote: Thus, programs must be written for people to read, and only incidentally for machines to execute. -- http://mitpress.mit.edu/sicp/front/node3.html On Sat, Mar 1, 2014 at 2:48 AM, Kashyap CK

ANN: Events in Scotland

2014-03-01 Thread Adrian Mowat
Hi All, Just a quick note to let everyone know about events in Scotland over the coming weeks. First up the inaugural meeting of the Glasgow Clojurians with be this Thursday (6th March) at Spaarks, 70 W Regent St, Glasgow at 7pm. We'll be running a Clojure Dojo based on what the guys in

Re: ace / codemirror in cljs

2014-03-01 Thread t x
No, it appears lighttable uses CodeMIrror. See: * https://github.com/LightTable/LightTable/search?q=codemirrorref=cmdform * http://www.chris-granger.com/2012/04/15/light-tables-numbers/ On Sat, Mar 1, 2014 at 3:02 AM, Dave Sann daves...@gmail.com wrote: have you considered reading the

Re: Clojure performance question

2014-03-01 Thread dennis zhuang
The String a=i+another word; is also compiled into using StringBuilder, see the byte code by javap -v: Code: stack=5, locals=5, args_size=1 0: invokestatic #2 // Method java/lang/System.nanoTime:()J 3: lstore_1 4: iconst_0 5:

Re: Clojure performance question

2014-03-01 Thread dennis zhuang
I forgot to note hat i test the java sample and clojure sample code with the same jvm options '-server'. 2014-03-01 20:03 GMT+08:00 dennis zhuang killme2...@gmail.com: The String a=i+another word; is also compiled into using StringBuilder, see the byte code by javap -v: Code:

Re: Clojure performance question

2014-03-01 Thread dennis zhuang
I think the remaining overhead of clojure sample code is that operators in java such as '++' and ' etc.They are just an instrument of JVM -- iinc and if_icmpge. But they are both functions in clojure,and they will be called by invokevirtual instrument.It cost much more performance. 2014-03-01

Re: [ANN] clojure.test.check (previously, simple-check)

2014-03-01 Thread keeds
Reid, Thank you kindly. That makes sense. Your help is much appreciated, as are your efforts with this library. Thanks, Andrew On Thursday, 27 February 2014 17:22:44 UTC, Reid Draper wrote: I'm happy to announce the first release of the newest Clojure contrib library: test.check [1].

Re: Clojure performance question

2014-03-01 Thread Jozef Wagner
Clojure math functions compile down to the same JVM 'instruction' as from java. See http://galdolber.tumblr.com/post/77153377251/clojure-intrinsics On Sat, Mar 1, 2014 at 1:23 PM, dennis zhuang killme2...@gmail.com wrote: I think the remaining overhead of clojure sample code is that operators

Re: Clojure performance question

2014-03-01 Thread dennis zhuang
Yep, you are right, inspecting the byte code generated by the clojure code: (loop [n 0] (when ( n 1000) (- (StringBuilder.) (.append n) (.append another word) (.toString)) (recur (unchecked-inc n It is: L4 LINENUMBER 4 L4 LLOAD 1 LDC 1000

Re: Clojure performance question

2014-03-01 Thread Jozef Wagner
From my experience, you can get 1/1.2 performance (20% slower) with Clojure by following these steps: * Choose right clojure idioms That means to never use lazy seqs if you care for java-like performance. For fast looping, use reducers, for fast inserts, use transients. Postpone the data

What is the right way to create dynamic var in another namespace?

2014-03-01 Thread Эльдар Габдуллин
I expected the following to work, but it doesn't: (defn declare-foo [] (intern *ns* (with-meta '*foo* {:dynamic true :private true}) foo)) Although it creates a var, it is not dynamic. We can mark it dynamic ourselves, but it seems that such ability is an implementation

Re: Clojure performance question

2014-03-01 Thread Shantanu Kumar
On Saturday, 1 March 2014 15:32:41 UTC+5:30, bob wrote: Case : clojure verison: (time (dotimes [n 1000] (str n another word))) ;; take about 5000msec java version long time = System.nanoTime(); for(int i=0 ; i1000 ;i++){ String a=i+another word;

I want to get sha1 of a string

2014-03-01 Thread action
do like this: (ns clojurewerkz.support.hashing (:require [clojurewerkz.support.internal :as i]) (:import [com.google.common.hash Hashing HashFunction HashCode])) but: FileNotFoundException Could not locate clojurewerkz/support__init.class or cloju rewerkz/support.clj on classpath:

Re: I want to get sha1 of a string

2014-03-01 Thread 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 clojurewerkz.support.hashing (:require [clojurewerkz.support.internal :as i])

Re: Latest web framework for clojure

2014-03-01 Thread Devin Walters
Have you checked out Http://hoplon.io? '(Devin Walters) On Feb 28, 2014, at 12:55, Daniel doubleagen...@gmail.com wrote: Long story short. You should be learning Pedestal, but the app component is on pause at the moment. My advice is to learn pedestal-service and Om. When Pedestal-app

Re: ANN: rx-cljs, A ClojureScript wrapper for Reactive Extensions

2014-03-01 Thread Michael Marsh
Awesome! I've been addicted to Rx lately and this is just what I need for one of my projects. I'll definitely check this out and let you know how it goes. On Tuesday, May 21, 2013 4:01:46 AM UTC-4, Leonardo Borges wrote: Hey guys, Given some recent work I've been doing with RxJS [1], I

Re: Reagent: ReactCSSTransitionGroup

2014-03-01 Thread Chris Sutela
Thanks so much Dan, that was a great help! the code ends up being:* (def ctg (- js/React (aget addons) (aget CSSTransitionGroup))) * but yeah, you were totally correct :) On Friday, February 28, 2014 5:34:34 AM UTC-8, Dan Holmsand wrote: Yes, Reagent doesn't know about React components that

Re: I want to get sha1 of a string

2014-03-01 Thread Zach Oakes
You can use java.security.MessageDigest. For example: (defn create-hash [data-barray] (.digest (java.security.MessageDigest/getInstance SHA1) data-barray)) It takes and returns a byte array, but converting from/to a string is fairly straight-forward: (- Hello, World! .getBytes

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

2014-03-01 Thread zcaudate
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 interested. Please send me a message Chris -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send

Re: Clojure performance question

2014-03-01 Thread bob
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. On Sunday, March 2, 2014 12:03:21 AM UTC+8, Shantanu Kumar wrote: On Saturday, 1 March 2014 15:32:41 UTC+5:30, bob wrote: Case : clojure

Re: Clojure performance question

2014-03-01 Thread Gary Trakhman
Core fns should be simple, unsurprising, and general. 'Improving' str may hurt simplicity, make behavior more surprising and unexpected, and less general unless proven otherwise. On Sat, Mar 1, 2014 at 7:02 PM, bob wee@gmail.com wrote: Good point, Thanks a lot. Shall we improve the str

isa? problem with collection type for multiple argument dispatch

2014-03-01 Thread Dave Tenny
(isa? [String String] [Object Object]) returns true. This is nice and useful. However (isa? '(String String) '(Object Object) returns false, this is not so nice. (isa? '(String String) [Object Object]) also return false. So the moral of the story is that for multiple argument dispatch to

Re: What is the right way to create dynamic var in another namespace?

2014-03-01 Thread Armando Blancas
This came up a while back and it appeared that the metadata just reflected whether the var was created with the ^:dynamic annotation. But the meta attribute is an output, so to speak; the info flows from the var declaration to the meta but not the reverse. Maybe it'll remain like that as

Re: isa? problem with collection type for multiple argument dispatch

2014-03-01 Thread Sean Corfield
Looking at the source of isa? it very specifically calls out vector arguments so I'd say it's by design. Be careful that (isa? '(String foo) '(String foo)) returns true - child equal to parent regardless of type. (defn isa? Returns true if (= child parent), or child is directly or indirectly

[ANN] avi: A lively vi. 0.1.0

2014-03-01 Thread Jason Felice
From https://github.com/maitria/avi Avi is a vi written in Clojure. It's currently very basic and read-only, but has solved the hardest problems first (JNI terminal writing, installation, booting the JVM). It currently supports h,j,k,l,^E,^Y,$,^,0,G,:q and command repeat counts. *Vision* A

Re: [ANN] avi: A lively vi. 0.1.0

2014-03-01 Thread Ambrose Bonnaire-Sergeant
Hi Jason, Angela, Wow, looks like fun! It would be nice just have to specify the install prefix path once, instead of in the bash and install.clj file. Also the bin directory needs to be manually created (same with the prefix directory). I tried running the executable, I got this:

Re: [ANN] avi: A lively vi. 0.1.0

2014-03-01 Thread Gaofeng Zeng
Hi Jason, Angela It is cool, but it not support linux. I modify the avi.install to make it support linux. On Sunday, March 2, 2014 12:25:50 PM UTC+8, Jason Felice wrote: From https://github.com/maitria/avi Avi is a vi written in Clojure. It's currently very basic and read-only, but has

Re: Clojure performance question

2014-03-01 Thread Shantanu Kumar
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 the bottleneck in your app and if you can come up with a version of