Fork me on GitHub

Weird interaction. Javas Math/abs cannot handle fractions, leading to weird, occasional exceptions.


Oh well, I can deal with floats


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 (, 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

Daniel Hines17:01:40

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?

Daniel Hines17:01:05

(And the nesting is important to the data. I can't just flatten)

Braden Shepherdson17:01:53

or the specter library.


assoc-in, update-in, get-in, etc, yeah


or clojure.walk if you need to visit each leaf

Daniel Hines18:01:09

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.


(update-in [[[1 2 3]]] [0 0] #(mapv inc %)) => [[[2 3 4]]]


if its nested, sequences are nodes

Daniel Hines18:01:37

Right, but now I want to do that for every node in the sequence at a particular sequence layer.


I question the need to preserve the nesting structure


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

Daniel Hines18:01:00

Yes! And if I could figure out a better way to represent the data, that would be much better.


that is going to depend a lot on what you need from that information


but for example:

 (fn [item a]
    (fn [item b]
       (fn [item c]
         [(assoc item :a a :b b :c c)])
 [[[{:foo :bar} {:foo :bar}]
   [{:foo :bar} {:foo :bar}]]
  [[{:foo :bar} {:foo :bar}]
   [{:foo :bar} {:foo :bar}]]]


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

Daniel Hines18:01:01

Thanks for this.

Daniel Hines18:01:03

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


isn’t that also one of the ideas behind


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]
	(let [numDays (-> localDateTime1 (.until localDateTime2 (ChronoUnit/DAYS)))]
	  (or (if (zero? numDays) numDays) (if (pos? numDays) numDays) 0))
   (catch Exception e)))


@epyatkevich cond?


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.


There's a word for that I think...


stockholm syndrome? 🙂


lol close... the one where you can no longer see the problem because you got too used to it.


more commonly used in tech


i guess just acclimation


it's like "nativist bias" or something like that


or being biased to what your used to