Skip to content

Commit

Permalink
simplify how params and body are bound
Browse files Browse the repository at this point in the history
  • Loading branch information
pandeiro committed May 10, 2012
1 parent c454c5b commit 59e4a9c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/noir/core.clj
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,10 @@
(defmacro defpartial
"Create a function that returns html using hiccup. The function is callable with the given name. Can optionally include a docstring or metadata map, like a normal function declaration."
[fname & args]
(let [[fname params] (macro/name-with-attributes fname args)
body (if-let [fv (first (filter vector? args))]
(second (split-at (inc (.indexOf args fv)) args)))]
`(defn ~fname ~@params
(let [[fname args] (macro/name-with-attributes fname args)
params (first args)
body (rest args)]
`(defn ~fname ~params
(html
~@body))))

Expand Down

0 comments on commit 59e4a9c

Please sign in to comment.