This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-01-30
Channels
- # announcements (2)
- # avi (12)
- # aws (6)
- # beginners (49)
- # boot (140)
- # cider (2)
- # cljs-dev (5)
- # cljsrn (9)
- # clojure (149)
- # clojure-czech (6)
- # clojure-miami (1)
- # clojure-nl (2)
- # clojure-russia (19)
- # clojure-ukraine (1)
- # clojurescript (34)
- # conf-proposals (36)
- # core-async (2)
- # cursive (11)
- # emacs (2)
- # funcool (23)
- # hoplon (2)
- # incanter (4)
- # jobs (1)
- # ldnclj (19)
- # om (47)
- # onyx (5)
- # proton (12)
- # re-frame (20)
- # ring-swagger (17)
- # testing (1)
@gabehollombe: interesting, thanks. There are so many functions to learn 😛
hey @doddenino: hickory uses jsoup, which many have experience with. do you have more details about the problem?
@polymeris: I don’t think so, because you’re not interested in the value of each iteration when you call iterate
— you just want it to iterate, yeah?
reductions
is so-named because you want all the reductions. (compare vs reduce
)
@gabehollombe: but iterate returns a seq of the intermediate values, no?
ah, I see what you’re getting at.
fair enough!
@polymeris: not involved with, but I have given Phaser talks! 😃
Yeah, use Pixi if you just want rendering, Phaser if you want more of a game framework. Although Phaser.next a.k.a. Lazer, will have their own renderer (no longer using Pixi) if I understand it right
@gabehollombe: either way (phaser or pixi), I have found it hard to getting it to work with cljs. The interop works ok, but it's just not designed with FP in mind. Any tips?
@jonahbenton I have a div containing spans. These spans can contain text, or another span containing text. I'm trying to get the text. I tried all the combinations of descendant, child, and, or, but I can only get one of the two span times at a time, not both together 😞
@polymeris: Alas, I haven’t done any FP style games yet
having some protocol confusion here
got this code:
(defprotocol ApiResource
(resource-url [self] [self opts]))
(defn _resource-url
"Construct URL for resource from `:id` and `:resource-type` keys."
([subject {:keys [base-url]}]
(if-let [path (_resource-url subject)]
(construct-full-url path base-url)))
([subject]
(let [id (:id subject)
type (:resource-type subject)]
(if (and id type)
(str "/" type "/" id)
nil))))
(extend-type java.lang.Object
ApiResource
(resource-url [self] (_resource-url self))
(resource-url [self opts] (_resource-url self opts)))
(resource-url {}) ;; expect nil, get ArityException
exception I get (with variation in the random numbers)
Unhandled clojure.lang.ArityException
Wrong number of args (1) passed to: core/eval27713/fn--27714
AFn.java: 429 clojure.lang.AFn/throwArity
AFn.java: 32 clojure.lang.AFn/invoke
core.clj: 46 hypertension.core/eval27478/fn/G
REPL: 1 hypertension.core/eval27717
The way I see it I've got single-arity implementations of everything, so I don't see what I've messed up
I believe that should look something like this:
(extend-type java.lang.Object
ApiResource
(resource-url
([self] (_resource-url self))
([self opts] (_resource-url self opts))))
presumably test-if-thing-exists
on its own would be enough?
if-let
and when-let
maybe
In the following code from this excellent blog post (http://sw1nn.com/blog/2012/04/11/clojure-stm-what-why-how/), the author is trying to convey an idea about commute
. That the commute
function will update the ref based on the value of the ref it reads 'at commit'. I'm I correct in assuming however, that in this case commute
is meaningless/usless because we're in a single thread? As in the first log-deposits
will always happen before the second'. Or put another way, it seems like commutes have not purpose unless your using multiple threads. Are dosync
or commute
starting background threads? I thought you would need to use future
explicitly for this to happen.
I'm also having trouble understanding why the commute function is called 'twice' as explained here: http://conj.io/store/v1/org.clojure/clojure/1.5.0/clj/clojure.core/commute. What does it mean >and returns the in-transaction-value of ref. why not commit this value at that point. Finally, I don't understand how the correct value is resolved using commute if their all potentially using 'old values' of ref. (which is what it looks like is happening the example at the end of this blog: http://squirrel.pl/blog/2010/07/13/clojure-alter-vs-commute/).
+ 100 cool points bounty.
I'm getting some Json using cljs-ajax but the map has "string" intead of :key. How do i get key-keys instead of string keys
Maybe the second 'commit'time' computation is 'usually less expensive' because its assumed large parts of the function are already evaluated?
(+ x 1 (+ 1 1)) ;; in-transaction
(+ x 1 2) ;; at commit time
Hello, I'm trying to teach myself clojure by transforming nested maps into CSS code but stuck with basic function composition...
(def css1 {"body" {:background-color :#d0e4fe}
"p" {:font-family "Times New Roman"
:font-size :20px}})
(defn o [[property value]]
(str (name property) " : " (if (keyword? value) (name value) (str "\"" value "\"")) ";"))
(defn oo [block]
(clojure.string/join "\n" block))
(defn ooo [[selector block]]
(str selector " { " block " }"))
(defn oooo [nestedmaps]
(clojure.string/join "\n" nestedmaps))
do you think my approach is totally flawed?are go-loops for async going to necessarily have side-effects? All the examples I see are like this:
(go-loop []
(let [fun (<! output-chan)]
(println "check")
(println (get fun 0))
(println (get fun 1))
(recur)))
@tmtwd: from my very naive perspective, no, your go loops don't necessarily have to have side effects. The ones your viewing probably do so they can show you how things are being executed.