Re: IntelliJ Cursive ClojureScript IDE slowdown

2014-06-22 Thread Mark Mandel
Yah, I noticed this as well. I figured it was something in the terminal plugin. Sent from my mobile doohickey On 22/06/2014 3:13 PM, Colin Fleming colin.mailingl...@gmail.com wrote: Hmm, thanks for the report - I'll take a look at this and see if I can figure out what's happening. One

Re: Understanding when compilation occurs - for function producing functions

2014-06-22 Thread Mark P
​Well, you misunderstand it, as far as I know, clojure treat all fn as object, so in your adder-maker example, clojure compiled two fn as object, that's adder-maker itself and anonymous function it returns. You must be right. As far as I know, the compiler is only called as part of

Re: Understanding when compilation occurs - for function producing functions

2014-06-22 Thread Mark P
What's the reason for asking? If you aim for making efficient code (that is running very many times in tight loops), I think most of this will be inlined by the JIT, as long as it is not confused by side effects and other things. I'm asking mostly because I want to better understand

Re: Understanding when compilation occurs - for function producing functions

2014-06-22 Thread Mark P
A toy project I've worked intermittently on makes heavy use of *partial* to dynamically build complex functions. I wish that *partial* was smart enough to recompile its first argument, maybe taking advantage of whatever type inference the compiler can make, but partial

Re: Understanding when compilation occurs - for function producing functions

2014-06-22 Thread Reid McKenzie
Coming from a C++ background I'm not that familiar with functions as first class values. We sort of do have them in C++ - as functors - ie a class that has the function invocation operator defined. This class can have storage as well, which means you can have a functor object type which

Re: IntelliJ Cursive ClojureScript IDE slowdown

2014-06-22 Thread Mike Fikes
Hi Colin, I'm still in the habit of manually saving, but I've noticed that IntelliJ saves quite often on its own. I usually work with :whitespace optimizations so that compilation completes within 3/10 s of saving. (I'm using this to build an iOS app using JavaScriptCore, so this is much

Re: IntelliJ Cursive ClojureScript IDE slowdown

2014-06-22 Thread Ewen Grosjean
Hi, This is probably related to this bug http://youtrack.jetbrains.com/issue/IDEA-125385?_ga=1.235172353.1252245333.1402961512 . -- 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

Re: IntelliJ Cursive ClojureScript IDE slowdown

2014-06-22 Thread Mike Fikes
Me too. I suspect it is an IntelliJ-specific problem, unrelated to Cursive. Perhaps Colin has the ability and insight to see where the problem lies. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to

Re: IntelliJ Cursive ClojureScript IDE slowdown

2014-06-22 Thread Colin Fleming
Hmm, that bug looks like a likely candidate. It's actually marked as fixed, but only in the v14 branch - I'll see if I can militate for it to be patched back to 13.1. Thanks for the feedback on saving, Mike. IntelliJ saves on its own at a couple of points - mostly on frame deactivation, i.e. when

Re: Workflow: cljx, cljsbuild tdd in one process

2014-06-22 Thread Bob Hutchison
Thanks for the tip, works nicely. I was doing the same thing Michal was doing. Cheers, Bob On Jun 20, 2014, at 11:07 AM, Michael Griffiths mikeygriffi...@gmail.com wrote: There's also a Leiningen plugin called lein-pdo that lets you run tasks in parallel: https://github.com/Raynes/lein-pdo

Re: Understanding when compilation occurs - for function producing functions

2014-06-22 Thread Herwig Hochleitner
2014-06-22 9:12 GMT+02:00 Reid McKenzie rmckenzi...@gmail.com: since there's no other way that we can take a function as a value prior to JVM 1.8 which has bytecode lambdas and which the reference Clojure implementation doesn't leverage yet if ever. Java 8 gained no such feature. Lambda

doseq with index

2014-06-22 Thread Răzvan Rotaru
Hi, Is there an elegant way to use a doseq or for and also get an index to use? I find myself using map-indexed in these cases, and I prefer more the for constructs. (doall (map-indexed (fn [i x] ;do stuff with side effects using i and x ) a-lazy-seq))

Re: doseq with index

2014-06-22 Thread Sam Ritchie
(doseq [[idx item] (map-indexed vector a-lazy-seq)] (do-stuff! item idx)) Răzvan Rotaru mailto:razvan.rot...@gmail.com June 22, 2014 at 1:50 PM Hi, Is there an elegant way to use a doseq or for and also get an index to use? I find myself using map-indexed in these cases, and I prefer more

Help with basic macros

2014-06-22 Thread Ryan Yogan
Hi, I am trying to understand macros and I am having trouble with the basics, I am working through some koans and I am stuck, an explanation not just a solution would be amazing. I would like to create a macro that can provide the following (if-else ( 5 2)) = nil (if-else ( 5 2) :then 'sure)

Re: Help with basic macros

2014-06-22 Thread James Reeves
Consider how you'd write a function to perform a similar task. A function can't delay evaluation, but it should work for something like: (if-else ( 5 2) :else 'no-way :then 'sure) = 'sure If you manage to write a function that can do the above, you're 90% of the way to writing a macro. -

Re: doseq with index

2014-06-22 Thread Mikera
I found this to be fairly common pattern so I wrote a doseq-indexed macro, which is part of my clojure-utils library. Source: https://github.com/mikera/clojure-utils/blob/master/src/main/clojure/mikera/cljutils/loops.clj usage: (doseq-indexed [x (some-sequence) i] ;; do things with x and i

Auto reloading of dependencies with cider

2014-06-22 Thread Mark P
I am fairly new to using cider. Initially I put all my code into my core.clj file that lein created for me. But now I am splitting my file up into multiple clj files and using things like: (ns myprog.core (:use [myprog.milk :as milkx :only []]) (:use [myprog.cheese.brie :as briex :only

Re: Understanding when compilation occurs - for function producing functions

2014-06-22 Thread Mark P
Okay. Functions as values. Go look at the IFn interface, https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/IFn.java. Thanks for the link - this helps! When the clojure compiler generates a class type that conforms to this interface, does it generate a .java file

Re: Understanding when compilation occurs - for function producing functions

2014-06-22 Thread Ryan Schmitt
Okay. Functions as values. Go look at the IFn interface, https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/IFn.java. Thanks for the link - this helps! When the clojure compiler generates a class type that conforms to this interface, does it generate a .java file

{ANN} clj.qrgen and securen-rand : generate QRCode and secure random in clojure

2014-06-22 Thread dennis zhuang
*clj.qrgen*: https://github.com/killme2008/clj.qrgen Generate QRCode in clojure: (as-file (from hello world)) *secure-rand*: https://github.com/killme2008/secure-rand Secure version for clojure.core/rand etc. (ns test (:refer-clojure :exclude [rand rand-int rand-nth]) (:use

Re: {ANN} clj.qrgen and securen-rand : generate QRCode and secure random in clojure

2014-06-22 Thread James Reeves
I maintain crypto-random https://github.com/weavejester/crypto-random, another secure-random wrapper. I suspect the advice you're using to generate your SecureRandom instance is outdated, because in general the default SecureRandom constructor is preferable. This page

Re: Understanding when compilation occurs - for function producing functions

2014-06-22 Thread Alex Miller
On Sunday, June 22, 2014 11:35:25 AM UTC-5, Herwig Hochleitner wrote: 2014-06-22 9:12 GMT+02:00 Reid McKenzie rmcke...@gmail.com javascript: : since there's no other way that we can take a function as a value prior to JVM 1.8 which has bytecode lambdas and which the reference Clojure

Re: Auto reloading of dependencies with cider

2014-06-22 Thread Ralf Schmitt
Mark P pierh...@gmail.com writes: What do other people generally do here? I suspect there is a commandline way of getting lein to do this for me. Is that what people do? Or do people just make sure they do C-c C-k in each relevant buffer? (But isn't this error prone - ie if you forget