Fork me on GitHub
#emacs
<
2022-09-27
>
Drew Verlee05:09:30

so clojures' reduce has this function signature like so: (reduce f val coll). it would be cool if there was a way to move to each of those elements (f, val, coll) by name or by position. Like i can move around using the parens, or the symbols, but the f arg will likely be a lot of parens that i have to go through to get to the val or the coll. For that matter is there anything which will just print them sort of like this...

(reduce (let [[f val coll] '[(fn [total n] (+ total n))  0 [1 "2" 3]]]
          {:f f :val val :coll coll}))

dpsutton12:09:39

Structural editing allows exactly that

Drew Verlee13:09:48

I must be missing some commands then. I have next-paren and next-symbol. If i knew what each thing was i could use those to traverse it, like i said, but it wouldn't be a direct lookup.

Drew Verlee13:09:37

Nothing like, jump to coll.

dpsutton17:09:57

Sorry I thought this was about movements. Not jumping to places

Drew Verlee20:09:16

thanks @U02CV2P4J6S i'm using what ever the lisp state is thats built into spacemacs, i think it's similar. @U11BV7MTK i'm probably not articulating the idea well. It occurs to me that if the params argument is a hashmap then you get this just by searching for the key. But a lot of functions, especially clojure core, are positional bc it makes them easier to write. cider and lsp both seem to be aware of positional arguments, so i'm guessing its possible to create a something to both display a mapping from parameter name to the actual argument passed in. I'm just collecting a bunch of things i'm going to try and build that i think would be useful for me and others as i learn emacs lisp 🙂 .