This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-10-29
Channels
- # bangalore-clj (2)
- # beginners (22)
- # boot (28)
- # cljs-dev (91)
- # cljsrn (4)
- # clojure (30)
- # clojure-austin (8)
- # clojure-conj (4)
- # clojure-japan (1)
- # clojure-russia (3)
- # clojure-spec (9)
- # clojure-uk (8)
- # clojurescript (42)
- # cursive (2)
- # editors (1)
- # hoplon (16)
- # klipse (91)
- # lein-figwheel (1)
- # luminus (9)
- # off-topic (4)
- # om (83)
- # onyx (29)
- # perun (6)
- # re-frame (17)
- # spacemacs (6)
- # untangled (1)
- # vim (5)
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 https://github.com/bbatsov/clojure-style-guide might be an interesting read for you
@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 đ )
I have installed it but when I want to make a repl with new run configuration I do not see anty clojure choice
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 http://stackoverflow.com/questions/6234018/executing-multiple-statements-in-if-else-without-nullpointer-exception
@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?
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))
...is 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.
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