This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-01-24
Channels
- # announcements (4)
- # beginners (37)
- # boot (13)
- # boot-dev (3)
- # calva (122)
- # cider (16)
- # clara (13)
- # cljs-dev (3)
- # cljsrn (8)
- # clojure (311)
- # clojure-denver (1)
- # clojure-dev (14)
- # clojure-europe (7)
- # clojure-italy (36)
- # clojure-nl (3)
- # clojure-spec (11)
- # clojure-uk (77)
- # clojurescript (91)
- # core-async (10)
- # cursive (9)
- # data-science (5)
- # datomic (46)
- # devcards (2)
- # emacs (6)
- # figwheel-main (15)
- # fulcro (51)
- # jobs (3)
- # kaocha (10)
- # nrepl (6)
- # off-topic (53)
- # om (1)
- # onyx (2)
- # pathom (5)
- # reagent (50)
- # reitit (26)
- # shadow-cljs (153)
- # spacemacs (17)
- # specter (5)
- # speculative (1)
- # test-check (19)
- # tools-deps (15)
- # yada (3)
Weird interaction. Javas Math/abs cannot handle fractions, leading to weird, occasional exceptions.
How do I deploy a clojure function to AWS Lambda without Datomic Ions. Is there a hello world example out there with pack.alpha?
Somehow I ended up with a bit of a pickle. When I run my app (`lein run`) or start the repl, everything works fine. But when doing (clojure.tools.namespace.repl/refresh)
, I suddenly get No namespace: my.namespace
error, even though it can normally find it
removing the :aot
key with it's value resolved the issue, but not exactly sure about the reasoning why
What are some general strategies for dealing with nested sequences? E.g if I want to map/reduce/filter on [[[{:foo :bar}]]]
? This is when I reach for transducers, right? Or are there other approaches?
(And the nesting is important to the data. I can't just flatten
)
update-in
, maybe?
or the specter library.
Correct me if I'm wrong, but update-in
and friends are for applying a transformation to a single node. I want to apply transformations to sequences. Clojure.walk could help - I'll have to revisit that.
Right, but now I want to do that for every node in the sequence at a particular sequence layer.
I imagine the nesting structure represents information you want to preserve, but the actually structure can be done away with to make processing easier as long as you preserve the information
Yes! And if I could figure out a better way to represent the data, that would be much better.
but for example:
(mapcat
(fn [item a]
(mapcat
(fn [item b]
(mapcat
(fn [item c]
[(assoc item :a a :b b :c c)])
item
(range)))
item
(range)))
[[[{:foo :bar} {:foo :bar}]
[{:foo :bar} {:foo :bar}]]
[[{:foo :bar} {:foo :bar}]
[{:foo :bar} {:foo :bar}]]]
(range))
that will result in a flat sequences of maps and all the maps having a, b, and c key which together indicate where they were nested
Thanks for this.
I wonder if this is where Meander comes in: http://timothypratley.blogspot.com/2019/01/meander-answer-to-map-fatigue.html
Timothy here claims with this sort of pattern matching, there's "only one way" to do things, and it's based on the shape of the data.
there are a couple of libraries (spectre maybe chief among them) that sort of claim to be a missing tool kit for dealing with deeply nested data, usually maps representing trees.
I have a hard time seeing the point of these libraries because the first thing I want to do when presented with deeply nested data with a lot of structure is removing the nesting and structure, maybe throwing the nesting away completely, or transforming it in to something more like an in memory database using clojure.set/index
is there a function to simplify the pattern for or
where you can return the matched value instead of the predicate true/false value? so as to not have to keep doing (or (if (pred1? n) n) (if (pred2? n) n) ….)
:
(defn daysDiff [localDateTime1 localDateTime2]
(try
(let [numDays (-> localDateTime1 (.until localDateTime2 (ChronoUnit/DAYS)))]
(or (if (zero? numDays) numDays) (if (pos? numDays) numDays) 0))
(catch Exception e)))
I used to get map fatigue, but after years of banging on maps, the rough edges sort of dissolved away and now I no longer feel the pain. I'm usually able to think through the transformation in a reasonable amount of time these days.