Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
(ns hello
(:require-macros
[macros :as macros]
)
)
; ...
(macros/indexMatrix 4 4 i x y (+ (fieldGet x y) i))
; ...
(ns macros)
(defmacro indexMatrix
[width height i x y body]
`(let [length# (* ~width ~height)]
(doseq [i# (range length#)]
(let [~i i#
~x (rem i# ~width)
~y (quot i# ~width)
]
)
(do ~@body)
)
)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.