This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-07-27
Channels
- # admin-announcements (1)
- # aws-lambda (2)
- # beginners (48)
- # boot (231)
- # capetown (1)
- # cider (35)
- # cljs-dev (25)
- # cljsrn (74)
- # clojure (273)
- # clojure-austin (2)
- # clojure-berlin (5)
- # clojure-hk (1)
- # clojure-poland (1)
- # clojure-russia (50)
- # clojure-spec (63)
- # clojure-uk (58)
- # clojurescript (51)
- # cursive (5)
- # datomic (39)
- # defnpodcast (3)
- # dirac (13)
- # editors (6)
- # emacs (3)
- # hoplon (86)
- # jobs (2)
- # lein-figwheel (1)
- # liberator (3)
- # off-topic (10)
- # om (113)
- # onyx (34)
- # protorepl (29)
- # re-frame (2)
- # reagent (8)
- # remote-jobs (1)
- # ring (4)
- # test-check (42)
- # untangled (31)
- # yada (2)
What does that do in JS?
(specifically, the unary +
there)
And is d
a JS object that you’d be mutating there?
In which case (set! (.-close d) (something (.-close d))
I guess… where something
is a function that does whatever the unary +
in JS does…?
@krchia: Could be… I’ve seen some very bizarre JS code that does coercions between types. I guess you’d have to know what values d.close
could possibly have and then work out a conforming cljs version from that.
I suspect that d.close
could be null
and +null
produces 0
so (or (.-close d) 0)
would work for that...
…but +"1"
produces 1
so if d.close
could be a string, I don’t know what the best cljs code would be...
@krchia @seancorfield yeah unary + is coercion to number, this looks like data sanitizing code
@krchia: I would use goog.string#toNumber()
@val_waeselynck: thanks!
@krchia: what happens if you assign the result of the (.range ...
expression to a var and call that?
@krchia: as in, if you just have
(def foo (.range (.scale js/d3.time) (clj->js [0 890])))
(foo 5)
Hello, can I get a hint what dudes do when need to get "some" for all values in the list ? Is it a job for "reduce" only ? or is there an elegant way (sry for interupt)
my god, i’m not sure if this mistake taught me anything other than not to be careless .. :’(
@brownmoose3q: not sure what you’re asking, could you give an example case?
@brownmoose3q: what do you mean by getting "some" for all values?
I'd like get every value in the seq in the way some does it. So, not a source value from the seq, mod modified one through predicate
can you give an example of what you want? Sorry, it's a bit hard to understand what you're saying
I'll check it no
or filter and then apply
oh, i'll check
yes, cool, thanks for help!
how can you serve a file with compojure? I don’t want to serve static files, just a file that gets generated dynamically (like an audio file)
iirc ring lets you put an inputstream in the :body of your response