This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
- # announcements (1)
- # babashka (27)
- # beginners (33)
- # cider (22)
- # clj-kondo (1)
- # cljdoc (2)
- # cljs-dev (8)
- # clojure (96)
- # clojure-australia (7)
- # clojure-europe (24)
- # clojure-nl (1)
- # clojure-taiwan (1)
- # clojure-uk (7)
- # clojuredesign-podcast (4)
- # clojurescript (23)
- # clojureverse-ops (1)
- # conjure (11)
- # cursive (29)
- # datahike (1)
- # datascript (8)
- # datomic (4)
- # emacs (1)
- # figwheel-main (1)
- # fulcro (3)
- # helix (7)
- # jobs (4)
- # lsp (6)
- # malli (3)
- # off-topic (35)
- # pathom (6)
- # re-frame (4)
- # releases (1)
- # sci (18)
- # shadow-cljs (14)
- # sql (1)
- # tools-deps (11)
- # xtdb (6)
Why is thread-last not able to resolve the % here?
(defn avg-noise-index [coll1 coll2] (->> (map noise-index-pairwise coll1 coll2) (reduce +) (/ % (count coll1))))
I assume you want this part
(/ % (count coll1)) to be a lambda? If so you’d need to add
#. So it would look like this
#(/ % (count coll1))
If you want to go the lambda route, don't forget to wrap it in an additional set of parens, otherwise it will return the function
Hmm okay thank you. I thought there was some way to manually place arguments in positions that aren’t the last position
#() can prove surprising when used with arrow macros. it expands to
(fn [%] (... %)) so the arrow would end up inserting your thing at the tail of that. while awkward you'd need to use
(#(/ % (count coll1))) for that
I have a struct in my program that stores some variables about stock-count, stock-price, etc I am not sure how I should approach this in a functional way... any suggestions?
the values would somehow have to change I think, and I need to keep track of the initial values
@sunchaesk atoms are useful for holding on to data. you can change the value of an atom using swap! which takes a function to apply to the data, or reset! which sets the data anew. if you are storing your values in a map, you can use something like
(swap! atom assoc key value) and if it is nested you can rely on
assoc-in [:path :to :value]
in general I think what you are looking for is swap!
(loop  (if-let [pom (try (read-pom* url) (catch java.net.ConnectException e (if (= "Operation timed out" (ex-message e)) (log/error (str "Fetching pom from " url " failed because it timed out, retrying")) (throw e))))] pom (recur)))
But if you want something more complete/robust,
diehard works well https://github.com/sunng87/diehard
Well, of course 🙃 Thanks @UJY23QLS1 - I’m changing someone elses code, so minimal intervention.
Hi, I'm Pattern-chaser, a retired firmware designer of many years. I've programmed with many languages over the years, but mainly the old ones. In order of my usage (most used first): C, ASM, C++, then BASIC, Pascal, Fortran, and a bit of C#. All prehistoric. 😉
I've fancied Clojure for quite a while, but (as you can see, above) my experience is with very different languages.
My current project is a Windows file-manipulation task, a program to checksum my music files, to verify them prior to backup. It needs to be very fast, as I have 100,000+ music files to check, and I don't want it to take all year! 😉 Is this a task I could approach with Clojure, do you think?
I do not know. Sounds like the main bottleneck will be IO (running CRC32 or whichever fast checksum you prefer).
since you don't care about being cryptographically secure, something like xxHash would be a good choice
what would be the bestway to handle maps(google maps/ mapbox) in clojure -> integrate it in js or handle it with clojure
Hard to provide unconditional advice without understanding a bit more about what you are trying to do.
Is your app server-side rendered (written in Clojure and generating HTML), or does it already have a ClojureScript front end?
im going to add live tracking on the map. app is not yet developed. I'm trying to add map to the pingcrm project