This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-09-10
Channels
- # beginners (191)
- # boot (3)
- # cljs-dev (2)
- # clojure (46)
- # clojure-austin (1)
- # clojure-spec (4)
- # clojure-uk (32)
- # clojurescript (10)
- # clojurewerkz (3)
- # cursive (14)
- # datomic (88)
- # defnpodcast (1)
- # editors (2)
- # fulcro (2)
- # hoplon (3)
- # jobs (4)
- # jobs-discuss (1)
- # luminus (5)
- # lumo (6)
- # off-topic (13)
- # random (1)
- # re-frame (50)
- # reagent (245)
- # remote-jobs (1)
- # spacemacs (3)
- # specter (16)
- # uncomplicate (4)
are there any sexp-aware repls? not looking to learn CIDER right now, but having to edit functions line-by-line is no fun
@sundarj Cursive with IntelliJ is the most popular
there are a few experimental browser-based ones but none as good as Cursive - I'd go with Cursive
@sundarj Dirac REPL[1] has parinfer enabled by default, that’s fine for small commands, but if you wanted to send there bigger sexps you are expected to drive it externally from your IDE via nREPL, e.g. with IntelliJ+Cursive[2] [1] https://github.com/binaryage/dirac [2] https://github.com/binaryage/dirac/blob/master/docs/integration.md
When type a hinting let expression, which is preferred (and is there a difference?) (let [x ^SomeType (.getValue obj)] ...)
vs. (let [^SomeType x (.getValue obj)] ...)
@jonas one is type hinting the return of (.getValue obj)
the other the "x" local binding. I guess your intention is on the local binding, so the second is more appropriate. As of the practical effects in this case, they are the same.
user=> (let [^String x (do (identity ""))] (.length x))
0
user=> (let [x ^String (do (identity ""))] (.length x))
Reflection warning, NO_SOURCE_PATH:7:37 - reference to field length can't be resolved.
0
if you type hint the init, and the expr is a macro/special form invocation that doesn't propagate form metadata, the type hint will be lost
I have the following problem 1. svg line, in hiccup, uses :x1 :x2 :y1 :y2 2. in a geom library I designed, I use :x0 :x1 :y0 :y1 my three choices are: 1. wrap svg hiccup, seems hacky 2. change my library to use x1 x2, y1 y2 -- I prefer 0-1 3. have abug prone translation every time Igo from "my lib" to "svg line"
is there an existing library that wires the java.time
classes up to edn readers/printers? e.g., #local-date "2017-09-10"
it doesn't exist at runtime
oh, nvm you got an answer from bronsa, gotta love Slack's scrolling (or lack of it)
(I was asking after a question in #beginners; someone was wondering why he couldn’t use aliases defined in my-namespace
after executing (use 'my-namespace)
)
When I’m generating something from a spec, how can I keep the generated structure from having super long keywords, strings, etc…
You can limit the size of something in a spec by using s/and
i.e. (s/and string? #(<= (count %1) 8))
. But if you're just worried about generation, use s/with-gen
instead, i.e. (s/with-gen string? #(s.gen/such-that #(<= (count %1) 8)) (s/gen string?)))
Hadn't thought of that for my strings. I suppose I could do something similar for keywords, in a roundabout kind of way.
I often spec first and generate to see how things are turning out. But it’s hard to read when keywords come up with 100+ characters.