Skip to content

Instantly share code, notes, and snippets.

@pbaille
Created November 17, 2018 19:52
Show Gist options
  • Select an option

  • Save pbaille/d82f95c3fb9c04f6b998b11d1e542f2f to your computer and use it in GitHub Desktop.

Select an option

Save pbaille/d82f95c3fb9c04f6b998b11d1e542f2f to your computer and use it in GitHub Desktop.
cljs dual names
;; derived from http://blog.fikesfarm.com/posts/2015-12-12-clojurescript-macro-functions.html
(ns dual-world
#?(:cljs (:require-macros [dual-world :refer [add]])))
#?(:clj (defmacro add [& xs] `(+ ~@xs 0.1))
:cljs (defn add [& xs] (apply + xs)))
(add 1 2)
#?(:cljs (apply add 1 2 []))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment