Fork me on GitHub

A clojure promise implements IFn and when invoked as a function (`(p value)`) will behave just like calling (deliver p value). Is there a special reason for this design?


Extremely minor question: anyone have a coding style or even a preference about when and where to use ; vs ;; comments? For instance, in JS, Java, and so on, inline comments (`// do the thing`) are frequently highlighted differently from doc comments (`/ Complex explanation with usage examples and whatnot. */`).


@amacdougall I use ;; for normal indentation-level comments, and ; for inline comments. It's also "a thing" to use ;;;, and ;;;; for different usages, according to different style guides, but, i don't really pay attn to that.


and I use ;x50 for sortof page breaks


also, there's (comment ...) which is useful, as well as the reader macro #_(...)


comment keeps my code colored interestingly, so quicker to read something which I want present in the code, eg for debugging, and I want to be able to execute individual lines out of it, but I don't want it to run on compile (eg when I'm testing db-accessing fns)


#_ is for just knocking out big chunks of code and whereas comment evaluates to nil, #_ is removed at compile time, so {:a #_(remove me) :Apple} is valid, where as the comment version of it would not be


(way more than you wanted to know, I'm sure. I just got done playing a touch-typing game and am residually in the mood to type a whole bunch I guess 😉 )


Can I ask here also questions about the cursive plugin


I have installed it but when I want to make a repl with new run configuration I do not see anty clojure choice


anyone a idea what went wrong ?


Thanks for the tips! I've been using #_ from time to time, yeah.


just curious, why does clojure (1.8) crash on null pointer exception when you forget to use do a la


Someone knows how long it take to get a licence when buying a licence for Cursive ?


You would kind of think there'd be a specific error message


@matan - in that situation, the user is calling (nil nil), so i can kinda see why it throws that exception. i agree that it’s a somewhat hostile error message, though. maybe “nil is not a function” would be more useful?


(i’m absolutely not part of the clojure team, just some schmo spitballing ideas)


@roelofw Ask in #cursive , Colin reads it.


Hey, here's one that is really confusing me... I've got a random-walk algorithm which is creating a maze by wandering around a grid creating links between cells. When I run the algorithm from the REPL, it runs like greased lightning. But when I run the same thing as part of a clojure.test test, it's much much slower.


...waaaait... let's see what happens if I remove the (clojure.spec.test/instrument).


Nope, no change, even after killing and cleaning the test environment.


(deftest test-generate
  (let [grid (g/create-grid 10 10)
        maze (aldous-broder/generate grid)
        ; getting to this line takes several seconds
...but in the REPL...
(aldous-broder/generate (g/create-grid 50 50)) running the algorithm over vastly more cells, but takes just a few seconds. The (10 10) version is instant.


Is the test environment doing anything else which might be slowing me down?


I mean, in the meantime I used :test-selectors to just skip that test when I'm not specifically tinkering with it. It's not part of the chain for any other code, so I'm not worried about it breaking incidentally.


that’s odd


i wonder if it’s possible to send your test to a REPL connected to your browser and use eg the chrome devtools profiler on it to see what’s happening


that’s probably what i would do because i like playing with the devtools profiler, but i haven’t ever sent a test to it so i don’t know whether that’s easy or hard


um right, forgot what channel i was in


not sure what to do in the context of clojure