This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-08-10
Channels
- # admin-announcements (1)
- # alda (1)
- # bangalore-clj (1)
- # beginners (94)
- # boot (139)
- # braveandtrue (1)
- # cider (19)
- # cljs-dev (21)
- # cljsjs (8)
- # cljsrn (79)
- # clojure (124)
- # clojure-austin (1)
- # clojure-belgium (1)
- # clojure-berlin (3)
- # clojure-hamburg (3)
- # clojure-quebec (1)
- # clojure-russia (77)
- # clojure-spec (5)
- # clojure-uk (18)
- # clojurescript (39)
- # conf-proposals (21)
- # core-async (5)
- # cursive (8)
- # datomic (40)
- # defnpodcast (1)
- # devcards (14)
- # dirac (5)
- # editors (1)
- # emacs (4)
- # jobs (1)
- # liberator (4)
- # onyx (29)
- # perun (15)
- # proton (15)
- # protorepl (9)
- # re-frame (47)
- # reagent (38)
- # ring (1)
- # rum (7)
- # specter (23)
- # untangled (8)
- # yada (55)
so does anyone know how to print out a transient vectors contents? if you know what i mean
I'd probably try asking in #C03S1KBA2 - that doesn't really sound like a beginner question š
in your snippet, if you add in a (println āi am hereā) at line 12-13 and run it again what do you get
in the loop
binding, no need to call the function again (at that point it isnāt a function anymore)
well, it is, but you are calling it twice, Iām sure that would cause some wonkiness
@guy just to be clear, I didn't mean you shouldn't ask that question here. I meant #C03S1KBA2 has 6 times more people than this channel, and your question sounded advanced enough to warrant asking there (not that there's some level of clojure skill you have to have to be allowed to talk there š )
and doall is intended for functions that return lazy collections, not simply to force any expression
playing with clj-time and feel really dumb. i canāt for the life of my figure out how to āuseā a formater
@oahner: did i miss that in the docs? it seems to jump right from āhereās how you see a list of parsersā to āhereās how you use a custom one"
@chadhs: I don't know if it's stated as such, but parse/unparse definitely accepts a formater object as its first argument, not the formater's keyword
it goes from (def custom-formatter (f/formatter "yyyyMMdd"))
to (f/parse custom-formatter "20100311")
maybe itās just me but this seems so complicated just to return a time value, compared to the UNIX date command that is.
@oahner: this ended up working well for me
(defn get-current-iso-8601-date
"Returns current ISO 8601 compliant date."
[]
(let [current-date-time (time/now)]
(time-format/unparse
(time-format/formatters :date-time-no-ms)
current-date-time)))
(get-current-iso-8601-date)
How do I refer to files in my resources folder so that they work with an uberjar (leiningen)
Make sure not to give a path. Just (io/resource "abc")
for "abc" directly in the resources directory.
in cljs, if def
produces ordinary JS variables, what does ^:dynamic
do when applied to a def
?
Trying to understand why when I put the function into the scope of another function, its behavior suddenly changes:
(first (map #(dep/transitive-dependents graph %1) [:a :b]))
=> #{:c :f}
(defn task2 [ruleset facts]
(let [graph (reduce apply-rule (dep/graph) ruleset)
dependents (map #(dep/transitive-dependents graph %1) facts)])
(first dependents) )
=> #'task2.core/task2
(task2 ruleset [:a :b])
IllegalArgumentException Don't know how to create ISeq from: task2.core$dependents clojure.lang.RT.seqFrom (RT.java:528)
We just take a function that needs 2 arguments, supply 1 with partial, and we get back a new function that only requires that last argument
(def rule1 [[:a :b] :-> :c])
(def rule2 [[:c :d :e] :-> :f])
(def rule3 [[:k :d :e] :-> :m])
(def rule4 [[:p :t] :-> :k])
(def ruleset [rule1 rule2 rule3 rule4] )
(require '[com.stuartsierra.dependency :as dep])
(defn apply-rule
[graph rule]
(let [[premises _ consequence] rule]
(reduce #(dep/depend %1 consequence %2) graph premises)))
but in any case, what I don't get is why the difference in how the (first ) behaves on the result