Created
December 29, 2016 23:18
-
-
Save MarkJr94/d8c8cbb55e8597b66147a2ca2c012eab to your computer and use it in GitHub Desktop.
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 clojure-noob.core | |
(:gen-class)) | |
;; This function works as expected | |
;; (macroexpand '(infix (1 + 1))) => (+ 1 1) | |
(defmacro infix | |
[infixed] | |
(let [[arg1 binop arg2] infixed] | |
(list binop arg1 arg2))) | |
;; This one for some reason thinks it needs two arguments, but should be the same | |
;; (macroexpand '(infix2 (1 + 1) ()))) => (+ 1 1) | |
;; (macroexpand '(infix2 (1 + 1))) => ArityException | |
(defmacro infix2 | |
[[arg1 binop arg2] infixed] | |
(list binop arg1 arg2)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment