3 ms·
As an exercise you could do on a REPL what a macro would do. Say you have a file containing “(1 + 1)”. Reading this (using slurp and read-str) would yield a li
by eval 8y ago
As an exercise you could do on a REPL what a macro would do.
Say you have a file containing “(1 + 1)”. Reading this (using slurp and read-str) would yield a list, eval-ing this list would however fail as it’s not valid Clojure.
To make it eval-able you transform the list (all the operations of the language are at your disposal as you’re just handling data) to (+ 1 1). It’s this operating on data between read and eval that macros do.