Skip to content

Instantly share code, notes, and snippets.

@mfikes
Last active February 2, 2021 18:23
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save mfikes/696d6e66b64431040f8ab25f33255dfe to your computer and use it in GitHub Desktop.
Macro with side effect in ClojureScript
% clj -M -m cljs.main
ClojureScript 1.10.773
cljs.user=> (require 'foo.core)
nil
cljs.user=> (foo.core/m 1)
here
2
(ns foo.core)
(defmacro m [a]
(println "here")
`(do-a-thing ~a))
(ns foo.core
(:require-macros [foo.core]))
(defn do-a-thing [x]
(inc x))
{: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