clojure testing

2014-03-13 Thread Ashutosh Varshney
when i write (expect true (if (valid? ashutosh a...@gmail.com 99 message1) true false)) for testing the function(valid?) i found lein test clojuregeek.test.contact Ran 0 tests containing 0 assertions. 0 failures, 0 errors. failure in (contact.clj:32) : clojuregeek.test.contact (expect

Re: Help a Startup use Clojure!

2014-03-13 Thread Savas Alparslan
Bad mouthing PHP only leads to more resistance. This video would help. Master Plan for Clojure Enterprise Mindshare Domination http://www.youtube.com/watch?v=2WLgzCkhN2g On Wed, Mar 12, 2014 at 11:00 PM, da...@dsargeant.com wrote: I just spent the day writing this document for my boss,

Clojure programs Implemented to DaCapo benchmark harness??

2014-03-13 Thread Spyros Ts
Hello all, I am trying to find some good and big programms in Clojure, since I want to implement them in the DaCapo harness for my dissertation. If someone can give me some links to download such programs I would be really grateful. Spyros . -- You received this message because you are

XOR two arrays into a third on Clojure

2014-03-13 Thread Ignacio Corderi
Hey guys, here is a huge performance problem I'm trying to figure out: ;; Say you have 2 data arrays sitting out there of 1 MB (def one-mb (byte-array (* 1024 1024))) (def another-mb (byte-array (* 1024 1024))) ;; and another one that should have the byte-by-byte XOR of the previous two

Re: XOR two arrays into a third on Clojure

2014-03-13 Thread Walter van der Laan
Try this: (defn inplace-xor [^bytes a ^bytes b ^bytes out] (let [ln (count a)] (loop [x 0] (if ( x ln) (do (aset-byte out x (bit-xor (aget a x) (aget b x))) (recur (inc x))) On Thursday, March 13, 2014 6:26:33 AM UTC+1, Ignacio Corderi wrote: Hey

Re: XOR two arrays into a third on Clojure

2014-03-13 Thread Michael Gardner
Might be slow because of the polymorphic nature of nth. If you replace nth with aget (and turn on *warn-on-reflection*, which is a good idea when performance-tuning), you'll get reflection warnings because Clojure doesn't know what Java method to use since it doesn't know what type of objects a

Re: expectations 2.0 has been released

2014-03-13 Thread Jochen
Hi Jay... thanks for all the great new features. There is just one strangeness I have, exceptions seem not to work with more-, but did with given. E.g. (expect (more- false identity AssertionError assert) false) fails with reporting failure in ( sample_test.clj:4) :

Re: expectations 2.0 has been released

2014-03-13 Thread Gal Dolber
Looks great! thanks for sharing On Thu, Mar 13, 2014 at 6:25 AM, Jochen joc...@riekhof.de wrote: Hi Jay... thanks for all the great new features. There is just one strangeness I have, exceptions seem not to work with more-, but did with given. E.g. (expect (more- false identity

Re: core.async is very slow for some cases, what to do?

2014-03-13 Thread Jörg Winter
You could also try out: http://docs.paralleluniverse.co/pulsar/ Am Dienstag, 11. März 2014 18:39:54 UTC+1 schrieb Эльдар Габдуллин: Each go block is executed via thread pool. On a channel side, producers and consumers are also decoupled. Such decoupling costs around 10-20 us per async

Re: jquery/$ in cljs

2014-03-13 Thread Herwig Hochleitner
FWIW, here is some helper code, to conveniently call jquery and other object-method style libraries under advanced compilation without needing externs or wrap the possible methods beforehand. Macros can be called with plain symbols.

Re: expectations 2.0 has been released

2014-03-13 Thread Jochen
Hi Jay unfortunately I found another one, again on AssertionErrors but this time with for-each: (expect AssertionError (from-each [a [1 2]] (assert (string? a ;; all pass as intended (expect AssertionError (from-each [a [1 2]] (assert (string? a ;; still all pass but should signal

Re: expectations 2.0 has been released

2014-03-13 Thread Jay Fields
Thanks for all the examples, I'll look today at getting these fixed up. On Thursday, March 13, 2014, Jochen joc...@riekhof.de wrote: Hi Jay unfortunately I found another one, again on AssertionErrors but this time with for-each: (expect AssertionError (from-each [a [1 2]] (assert

[GSoC] Proposal: persistent probabilistic data structures

2014-03-13 Thread Matteo Ceccarello
Hello everybody, I just submitted my proposal for this year's GSoC. I already introduced the topic on this mailing list. Here you can find the complete proposal: http://www.google-melange.com/gsoc/proposal/public/google/gsoc2014/matteo_ceccarello/5778586438991872 So, if you have suggestions on

Re: XOR two arrays into a third on Clojure

2014-03-13 Thread Leif
Hi, Ignacio. Performance tuning in clojure being somewhat complicated, I would look for prior art here. For instance, the suggestions above give me a 6x speedup, but it's still *way* slower than the equivalent java code. So I used Prismatic's hiphip (array)! library on your problem (but with

Re: [ClojureScript] Re: Test G.Closure lib release 0.0-20140226-71326067

2014-03-13 Thread David Nolen
Andrew, I've tried the new JARs on a couple of projects and I have not encountered these issues. Did you make sure to run a `lein cljsbuild clean`? Thanks. David On Wed, Mar 12, 2014 at 8:19 PM, Andrew Keedle akee...@gmail.com wrote: Stuart, Did you ever get any response to this? I made

Re: XOR two arrays into a third on Clojure

2014-03-13 Thread Alex Miller
Agreed with all the comments on this so far. I would also say that dotimes is slower than loop for stuff like this so I would also make that change. (defn inplace-xor [^bytes a ^bytes b ^bytes out] (let [len (alength a)] (loop [i 0] (when ( i len) (aset-byte out i (bit-xor

Re: XOR two arrays into a third on Clojure

2014-03-13 Thread Michael Gardner
On Mar 13, 2014, at 07:34 , Alex Miller a...@puredanger.com wrote: Agreed with all the comments on this so far. I would also say that dotimes is slower than loop for stuff like this so I would also make that change. The dotimes version is slightly faster on my hardware. Why would it be

Re: core.async is very slow for some cases, what to do?

2014-03-13 Thread Timothy Baldridge
Instead (! channel) (! channel val) you do (! (take! channel)) (! (put channel val)). That would make channels even slower, not to mention that it would probably completely break interaction with alts!. I'm not saying it absolutely couldn't be done, I just don't see a need for it. core.async is

Re: XOR two arrays into a third on Clojure

2014-03-13 Thread Jozef Wagner
Note that looping with primitive int is faster than with long, and native array functions accepts/returns int instead of long for their index and length. It is very hard to eliminate boxing without dropping to java. In you example, calling bit-xor does 2 autoboxing (and 1 long to int cast as

declare and def

2014-03-13 Thread Plínio Balduino
Hi there Is there any difference between declare and def when I'm making a forward declaration? Thanks Plínio -- 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

Re: declare and def

2014-03-13 Thread Gal Dolber
#'declare adds extra meta to the var {:declared true} I don't think it's being used right now, but it can be specially handled by the compiler, for example, to ignore the #'declare stataments from the emitted bytecode, I'm experimenting with this here:

Re: declare and def

2014-03-13 Thread Ambrose Bonnaire-Sergeant
Wasn't aware of that. Looks like it's being used here https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Compiler.java#L401 Thanks, Ambrose On Thu, Mar 13, 2014 at 10:14 PM, Gal Dolber g...@dolber.com wrote: #'declare adds extra meta to the var {:declared true} I don't

Re: XOR two arrays into a third on Clojure

2014-03-13 Thread Leif
Based on what Jozef said, I could write (defn inplace-xor-hh [^bytes a ^bytes b ^bytes out] (hiphip.array/afill! Byte/TYPE [_ out x a y b] (bit-xor (long x) (long y It took 2 ms on my machine, vs. 80 ms for the 'dotimes' solution.' I think that matches java's speed, but if not, I'm

Re: [ClojureScript] Re: Test G.Closure lib release 0.0-20140226-71326067

2014-03-13 Thread Andrew Keedle
Huge apologies Stuart and David. In one of my projects I have a :hook for leiningen.cljsbuild. In the one I was testing and on a lein new mies ... it doesn't; so my lein clean was not doing a lein cljsbuild clean. Doh!!! Sorry for wasting your precious time and thanks for all your efforts on

Re: Om-powered HTML slide-decks

2014-03-13 Thread Manuel Paccagnella
Wonderful! I was looking for something like this for a while. I've managed to make it work following the instructions (after creating a symlink from qcon2014 to qcon), and I plan to use it for my next presentation. It'd be very useful a way to easily create blank slide decks (lein template and

Re: Help a Startup use Clojure!

2014-03-13 Thread Nando Breiter
I'm developing applications in CFML, which runs on the JVM. If you use the open source Railo version, it is possible to run Clojure and CFML side by side, sharing data structures between them, which should allow you to refactor, or initially build, those parts of the application that would benefit

Re: declare and def

2014-03-13 Thread Andy Fingerhut
The Clojure lint tool Eastwood (https://github.com/jonase/eastwood) uses this {:declared true} metadata to distinguish between a declare followed later by a def on the same var (no warning) from a def followed later by another def on the same var (when it issues a warning). declare is also an

Re: Help a Startup use Clojure!

2014-03-13 Thread Alan Thompson
Hey, I love your write-up! You should put that in a blog post so more people can read it share it. Alan On Mar 12, 2014 2:00 PM, da...@dsargeant.com wrote: I just spent the day writing this document for my boss, called The case for Clojure. I hope it helps. We are in exactly the same boat,

STM and persistent data structures performance on mutli-core archs

2014-03-13 Thread Andy C
Hi, So the other day I came across this presentation:http://www.infoq.com/presentations/top-10-performance-myths The guy seems to be smart and know what he talks about however when at 0:22:35 he touches on performance (or lack of thereof) of persistent data structures on multi-core machines I

Re: Om-powered HTML slide-decks

2014-03-13 Thread Laurens Van Houtven
Hi Malcolm, Love the code, excited about the talk as well. Will it eventually end up on infoq.com/Clojure? thanks in advance lvh -- 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

Re: STM and persistent data structures performance on mutli-core archs

2014-03-13 Thread Timothy Baldridge
I talked to Martin after a CodeMesh, and had a wonderful discussion with him about performance from his side of the issue. From his side I mean super high performance. You have to get a bit of background on some of his work (at least the work he talks about), much of what he does is high

Re: Help a Startup use Clojure!

2014-03-13 Thread Sean Corfield
As the author of cfmljure, it's not something I'd recommend anyone to use in its current form and combining CFML and Clojure (as we do at World Singles) is a bit of a dark art that I wouldn't encourage others to attempt, unless they're already up to their eyeballs in CFML, and running on Railo

Re: Help a Startup use Clojure!

2014-03-13 Thread Nando Breiter
Ah, that's a pity cfmljure isn't as easy to use as I thought it was. In the tradeoff between skilled Clojure developers being a rare and perhaps expensive commodity and the need to rapidly develop an app to fulfill business goals (and keep your job), cfmljure seems like it could offer a means to

Re: XOR two arrays into a third on Clojure

2014-03-13 Thread Alex Miller
My best guess would be that I've used the loop version in places where I had (set! *unchecked-math* true) - I see that dotimes uses unchecked-inc so that might explain it. See what happens with this version. (defn inplace-xor [^bytes a ^bytes b ^bytes out] (let [len (alength a)] (loop [i

Re: shenandoah

2014-03-13 Thread James Reeves
I believe Clojure does tend to use the JVM GC more than idiomatic Java does, but I haven't really noticed any slowdown related to this. My guess is that it really depends on what you're doing. Clojure data structures are pretty fast, and there are optimisation like transient collections that

Re: shenandoah

2014-03-13 Thread Raoul Duke
(related: asteroids in cal, by way of haskell. http://s3.amazonaws.com/ns999/cal.html) -- 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

Re: XOR two arrays into a third on Clojure

2014-03-13 Thread Ignacio Corderi
This is a lot messier than I thought it would be. So far the fastest code is from @Michael_Gardner with the dotimes (~100ms) Once I add :jvm-opts ^:replace [] on my profile and (set! *unchecked-math* true) several examples drop to ~80ms but @Leif example using hiphip drops to ~30ms. @Leif I

Re: shenandoah

2014-03-13 Thread Dennis Haupt
i also did an asteroid game in clojure. i don't think you can ever achieve the performance of hackedyhack-mutablility with pure functional algorithms - my approach to get the best performance while staying as clean as possible would be to keep two copies of the game world, using one as source data

Re: [GSoC] Proposal: persistent probabilistic data structures

2014-03-13 Thread Nicola Mometto
Matteo, best of luck with your proposal, all of those seem like good potential additions to the clojure data-structure landscape. BTW I'm too a fellow UniPD clojure user so you can inc the counter :) Nicola Matteo Ceccarello writes: Hello everybody, I just submitted my proposal for this

Re: XOR two arrays into a third on Clojure

2014-03-13 Thread Ignacio Corderi
Ok so, This is what i got of running @Lein code example using hiphip 4 times in a row, performance is now acceptable add I'm happy about it Elapsed time: 9.096 msecs Elapsed time: 1.707 msecs Elapsed time: 1.493 msecs Elapsed time: 0.839 msecs Turning :aot on didn't fix the first outlier, so

Re: Help a Startup use Clojure!

2014-03-13 Thread Jarrod Swart
Oh wow, thanks for all the responses! I'm certainly not making it a PHP vs. Clojure all or nothing debate. Anything other than PHP would be helpful, not simply because I want to bad mouth PHP. After 2 years working with it I know firsthand its shortcomings for building actual applications.

Re: clojure debugging repl

2014-03-13 Thread Paul Reidy
Did anyone ever get this working ? On Saturday, January 25, 2014 10:42:27 AM UTC-5, Magomimmo wrote: On Jan 25, 2014, at 2:12 AM, Alexandr Kurilin al...@kurilin.netjavascript: wrote: I'd love to be able to set breakpoints in a running clojure application, step through the code and

[GSoC 2014] Looking for mentors: cljs graphics package (in the spirit of p5.js / quil / three.js)

2014-03-13 Thread Omer Shapira
Hey, I'm applying to GSoC this year, and I'm looking for mentors. I want to create a cljs-idiomatic web graphics package. I have graphics programming experience, being a member of the Processing and openFrameworks communities, and a researcher at Ken Perlin's lab at NYU. While I'm still

Re: STM and persistent data structures performance on mutli-core archs

2014-03-13 Thread Andy C
On Thu, Mar 13, 2014 at 11:24 AM, Timothy Baldridge tbaldri...@gmail.comwrote: I talked to Martin after a CodeMesh, and had a wonderful discussion with him about performance from his side of the issue. From his side I mean super high performance. [...] Hi Tim, Thanks for explaining the