This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2024-01-30
Channels
- # announcements (5)
- # babashka (2)
- # beginners (85)
- # cider (59)
- # cljs-dev (2)
- # clojure (10)
- # clojure-europe (61)
- # clojure-gamedev (20)
- # clojure-nl (2)
- # clojure-norway (9)
- # clojure-uk (5)
- # cursive (24)
- # data-science (4)
- # datascript (8)
- # emacs (1)
- # fulcro (8)
- # graalvm (30)
- # gratitude (9)
- # hyperfiddle (71)
- # introduce-yourself (1)
- # jackdaw (1)
- # leiningen (8)
- # london-clojurians (1)
- # missionary (3)
- # other-languages (10)
- # pathom (8)
- # pedestal (18)
- # polylith (4)
- # proletarian (5)
- # reitit (7)
- # releases (4)
- # ring (8)
- # sci (10)
- # shadow-cljs (27)
- # squint (3)
- # tools-deps (2)
- # xtdb (17)
morning
Morning!
From time to time I need to convert some edn config stuff into json. Is there some simple way to retain the order of the keys of such a static blop of EDN?
isn't there a tool @U04V15CAJ wrote that can do this?
Phew, been a while since I used zippers 😅 Seems to be able to do what I want, although I had to add some functions for creating comma-nodes. At least this experiment could lead to a simple PR, if nothing else
I had fun (and profit 🙂 ) with rewrite-clj on EOG, @U052XLL3A, just a testimonial 🙂
you don't have to use zippers necessarily, I use rewrite-clj to work with the raw nodes a lot of the time
Yeah, I'm trying both approaces, but I'm having a hard time understanding how to use the nodes api for some reason - it will allow me to comma-separate nodes, but then the convertion back to strings goes haywire
I think I could also add an option to #C04QVMQ39LG to let you create ordered maps instead of regular hash-maps from map literals
Well, of course if I can get others to solve my problem, that's easier 😄 But won't you have the same issue, if you have regular, unordered hash maps as an intermediate structure, @U04V15CAJ?
it first parses the elements and then creates the hash-map, I could just make that configurable
$ clj -Sdeps '{:deps {borkdude/edamame {:git/url "" :git/sha "ce78f7b64381489c3feee7db40683cc5d0ec713d"} org.flatland/ordered {:mvn/version "1.15.11"}}}'
user=> (require '[edamame.core :as e])
nil
user=> (require '[flatland.ordered.map :as m])
nil
user=> (e/parse-string "{:a 1}" {:map m/ordered-map})
#ordered/map ([:a 1])
user=> (e/parse-string "{:x [{:a 1}]}" {:map m/ordered-map})
#ordered/map ([:x [#ordered/map ([:a 1])]])
with json:
user=> (j/write-str (e/parse-string "{:a 1 :b 2 :c 3 :d 4 :e 5 :f 6 :g 7 :h 8 :i 9 :j 10 :k 11 :l 12}" {:map m/ordered-map}))
"{\"a\":1,\"b\":2,\"c\":3,\"d\":4,\"e\":5,\"f\":6,\"g\":7,\"h\":8,\"i\":9,\"j\":10,\"k\":11,\"l\":12}"
I think most tools just don't know the concrete type of the map, most core functions work against the interfaces behind it
Well cheshire as well - I guess it's just that the ordered map implements iteration in a certain way?
ok, I'll make a release, this is something I've wanted to support anyway and this felt like a good time :)
Generally I'd say yes. I've rarely used sets in config data, but they probably have their place
Oh Durable Queue how I loved you. But on later Java versions……
SLF4J: See for further details.
Execution error (IllegalArgumentException) at durable_queue.Task/status_BANG_ (durable_queue.clj:176).
No matching method put found taking 2 args for class java.nio.DirectByteBuffer
I was trying to keep up with the issue comments in clj-commons as it’s there as an issue. Not clear if it was ever merged or not.
Removed it for now, I can still call all my defmethods directly without any fuss, I just liked the queue there to handle the request load (not a problem I ever had 🙂 )