3 ms·
I made a reader macro (not technically supported by Clojure, but I don't care) for these situations that provides something I call the "scoping operator".
by saurik 14y ago
I made a reader macro (not technically supported by Clojure, but I don't care) for these situations that provides something I call the "scoping operator".
#>a 6
#>(let [b 7])
#>(while true)
...
Using this operator, the above code is then equivalent to the below code, which I find much easier to deal with for code that is strictly linear in execution semantics.
(let [a 6]
(let [b 7]
(while true
...)))
I don't use it for most functions, however, only those where I find myself otherwise ending up in nested expression hell. When I do, however, it works perfectly with other language features (example: doing a syntax quote on a #> works exactly as one would hope; it is conceptually just a fancy macro).
(...and where breaking up the logic into smaller functions would just obfuscate the process, as the steps fundamentally could only be called from a single place anyway, turning the nesting into an even-worse problem of broken apart logic.)