3 ms·
This is where Lisp-like languages excel with macros. An example in Clojure: (defmacro do* [body expr cond] `(~expr ~cond ~body)) (do* (pr
by dig1 2y ago
This is where Lisp-like languages excel with macros. An example in Clojure:
(defmacro do* [body expr cond]
`(~expr ~cond
~body))
(do* (println "hello") if true)
(do* (println "hello") when-not (> 1 2))
- BoingBoomTschak 2y agoYeah, this is the kind of material that shows that any attempt to prevent/hamper meta-programming or punt it to preprocessors is at best misguided. It also feeds the smug Lisp weenie within me. Above all the wonders of Lisp's pantheon stand its metalinguistic tools; by their grace have Lisp's acolytes been liberated from the rigid asceticism of lesser faiths. Thanks to Macro and kin, the jolly, complacent Lisp hacker can gaze through a fragrant cloud of setfs and defstructs at the emaciated unfortunates below, scraping out their meager code in inflexible notation, and sneer superciliously. It's a good feeling. -- iterate manual, A.1 Introduction do..while is also the example used here https://www.tcl-lang.org/man/tcl9.0/TclCmd/uplevel.html https://www.tcl-lang.org/man/tcl9.0/TclCmd/uplevel.html