% clj -M -m cljs.main
ClojureScript 1.10.773
cljs.user=> (require 'foo.core)
nil
cljs.user=> (foo.core/m 1)
here
2
Last active
February 2, 2021 18:23
-
-
Save mfikes/696d6e66b64431040f8ab25f33255dfe to your computer and use it in GitHub Desktop.
Macro with side effect in ClojureScript
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns foo.core) | |
(defmacro m [a] | |
(println "here") | |
`(do-a-thing ~a)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns foo.core | |
(:require-macros [foo.core])) | |
(defn do-a-thing [x] | |
(inc x)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{:deps {org.clojure/clojurescript {:mvn/version "1.10.773"}}} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment