This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-10-22
Channels
- # announcements (11)
- # babashka (4)
- # beginners (98)
- # calva (18)
- # chlorine-clover (1)
- # cider (44)
- # clj-kondo (6)
- # clojure (61)
- # clojure-australia (4)
- # clojure-dev (4)
- # clojure-europe (132)
- # clojure-italy (5)
- # clojure-nl (4)
- # clojure-uk (31)
- # clojurescript (40)
- # community-development (8)
- # conjure (20)
- # data-science (1)
- # datomic (42)
- # defnpodcast (6)
- # emacs (3)
- # events (1)
- # fulcro (9)
- # graphql (2)
- # hugsql (1)
- # jobs (1)
- # malli (4)
- # off-topic (28)
- # pathom (27)
- # rdf (1)
- # re-frame (10)
- # reagent (4)
- # remote-jobs (1)
- # reveal (32)
- # sci (5)
- # shadow-cljs (18)
- # spacemacs (1)
- # tools-deps (62)
- # xtdb (4)
Is there a command to sort all the keys in maps? (In the source file, not with a sorted-map.) Similarly, I'd like to sort all functions arguments.
If there is no such command, wrap the hash-map with sorted-map
and use cider-eval-last-sexp-and-replace
There's pretty cool, yet a tiny bit complicated way of doing this using babashka:
So you're gonna need to run shell-command-on-region
with a prefix C-u M-|
shell-command-on-region
sends marked region to an external command, when called with a prefix, it replaces the selected text in the buffer with the result of the command.
So you do exactly this: C-u M-| bb '(into (sorted-map) *input*)' RET
and it does it. Now, if you do this fairly often, next time you can call C-u M-|
, you can press C-r
and find your babashka call.
There's pretty cool, yet a tiny bit complicated way of doing this using babashka:
So you're gonna need to run shell-command-on-region
with a prefix C-u M-|
shell-command-on-region
sends marked region to an external command, when called with a prefix, it replaces the selected text in the buffer with the result of the command.
So you do exactly this: C-u M-| bb '(into (sorted-map) *input*)' RET
and it does it. Now, if you do this fairly often, next time you can call C-u M-|
, you can press C-r
and find your babashka call.