This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-12-26
Channels
- # adventofcode (2)
- # babashka (17)
- # babashka-sci-dev (4)
- # beginners (8)
- # chlorine-clover (4)
- # clj-kondo (18)
- # clj-on-windows (1)
- # clojure (11)
- # clojure-india (12)
- # clojure-nl (1)
- # clojure-spec (9)
- # clojure-uk (3)
- # clojurescript (9)
- # conjure (3)
- # events (1)
- # graalvm (6)
- # lsp (6)
- # meander (4)
- # music (2)
- # off-topic (10)
- # other-languages (9)
- # re-frame (2)
- # releases (1)
- # reveal (8)
- # sci (1)
- # tools-deps (6)
Just found this wicked AoC Day 1 solution:
(defn inccount [input]
(count (filter true? (map < input (next input)))))
I did not know that you can add multiple collections to a map function.Hello! Imagine I have a vector like
[:start-process "some-process-id" :as "process-instance-id"]
and want to extract "some-process-id"
and "process-instance-id"
from it (I don't care about the other elements and at the time when I'm doing this I am sure that the vector has exactly this structure.)
What is the right way to do it?
Specifically, can I tell destructuring to ignore parts of the vector?
Something like this (`_`means that I am not interested in that value):
[[_ process-id _ instance-id] [:start-process "some-process-id" :as "process-instance-id"]]
I have several functions where the same spec fdef is used. Is there a way to share the fdef between the functions and avoid the code duplication?
You can use s/def instead and refer to the same function spec (by name or var)
fdef is really just s/def with symbol as function name instead of a keyword
Hello I am trying to work with the reagent and created a simple html component, the problem I am getting when I am trying to define the reagent/atom inside the let scope it is not working but when I am trying to define the atom outside the function it is working fine, how can I make the reagent/atom work properly define in the let scope ?
(defn click-count []
(let [click-count (reagent/atom 0)]
[:div
"The atom " [:code "click-count"] " has value: "
@click-count ". "
[:input {:type "button" :value "Click me!"
:on-click #(swap! click-count inc)}]]
))