This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-02-08
Channels
- # aleph (11)
- # arachne (7)
- # aws (1)
- # bangalore-clj (4)
- # beginners (24)
- # boot (128)
- # bristol-clojurians (23)
- # cider (1)
- # cljs-dev (43)
- # cljsrn (6)
- # clojure (178)
- # clojure-austin (3)
- # clojure-chicago (1)
- # clojure-dusseldorf (14)
- # clojure-finland (15)
- # clojure-france (6)
- # clojure-italy (18)
- # clojure-portugal (2)
- # clojure-russia (67)
- # clojure-spec (148)
- # clojure-uk (55)
- # clojurescript (199)
- # core-async (4)
- # cursive (18)
- # datascript (5)
- # datomic (120)
- # devcards (3)
- # dirac (53)
- # emacs (11)
- # events (3)
- # gsoc (7)
- # jobs (1)
- # lein-figwheel (25)
- # leiningen (5)
- # lumo (12)
- # off-topic (29)
- # om (174)
- # om-next (2)
- # onyx (7)
- # perun (10)
- # protorepl (6)
- # re-frame (12)
- # remote-jobs (1)
- # ring (19)
- # ring-swagger (25)
- # rum (6)
- # spacemacs (13)
- # sql (3)
- # untangled (88)
- # yada (7)
@upgradingdave you're on the right track: the File objects will not have normal Clojure equality semantics (value equality). You can look for dups though if you can grab something unique about them, like their name
property:
(into #{} (map (fn [file] (.-name file))) list-of-files)
hello! what would be the idiomatic way to generate a vector of vectors (fixed size)? my solution uses recursion but i think there is a simpler way to achieve than this:
(defn generate-vector-of-vectors
([n] (generate-vector-of-vectors n []))
([n vector-of-vectors]
(if (zero? n)
vector-of-vectors
(generate-vector-of-vectors (dec n) (conj vector-of-vectors (vec (repeatedly 10 #(rand-int 11))))))))
You just want a vector of empty vectors?
(into [] (repeat n []))
perhaps?
no, a vector of vectors containing random integers
hmmm... (vec (repeat n (repeatedly 10 #(rand-int 11))))
is almost there 😛
someone who can help me mock-up this part
"home.html" {:data {:paintings (-> (client/get url options)
so I can test this function : (defn fetch-paintings-and-images-front-page
[ids]
(let [paintings (pmap (comp get-data-front-page get-art-object read-json-data) ids)
images (pmap (comp get-image-url read-image-data) ids)]
(mapv merge paintings images)))
which is in another namespaceand is this good :
:args (s/cat :args (s/coll-of ::objectNumber))
the args schould be a collection of objectnumbers where objectnumbers is a string.Is throwing an exception (e.g. version check of a db record for optimistic concurrency) an idiomatic use in Clojure? I've read about failjure (https://adambard.com/blog/introducing-failjure/) and ex-info (https://clojuredocs.org/clojure.core/ex-info). My current feeling is that failjure is appropriate for not so exceptional cases, while throwing an exception might be reasonable in truly exceptional cases (like optimistic concurrency?). I would love to read some opinions on this.
I try to solve this failing spec :
:data #:clojure.spec{:problems [{:path [], :pred map?, :val nil, :via [:paintings2.api-get/artObject], :in []}]}
all the code pf my site can be found here : https://github.com/rwobben/paintings
Trying to use reduced. Using this code sample from https://clojuredocs.org/clojure.core/reduced (reduce (fn [a v] (if (< a 100) (+ a v) (reduced :big))) (range 10))
I get the following error
CompilerException java.lang.ClassNotFoundException: clojure.core.reduced, compiling:(NO_SOURCE_PATH:1)
Aha, I see the problem. Though I have the latest clojure, the version of clooj that I have is using 1.4.0.
The exact code copy/pasted into the Leiningen repl works fine for me. What version do you have?
Thanks
Anybody do slack webhook integrations?
Code
(http/post "https://hooks.slack.com/services/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"
{:debug true
:form-params {:payload (json/encode {"text:" “TEST”})}})
Error
status: 500
body: missing_text_or_fallback_or_attachments
not sure how json/encode
works, my code uses a json/generate-string
eg:
(json/encode {:text "TEST"})
it was the :
after text in string
if you're using clj-http @josh_tackett , no need to call json/encode. https://github.com/dakrone/clj-http#post Use :content-type :json and :form-params