Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/expander.wisp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"wisp syntax and macro expander module"
(:require [wisp.ast :refer [meta with-meta symbol? keyword?
quote? symbol namespace name
unquote? unquote-splicing?]]
unquote? unquote-splicing? gensym]]
[wisp.sequence :refer [list? list conj partition seq
empty? map vec every? concat
first second third rest last
Expand Down Expand Up @@ -288,7 +288,10 @@
id (with-meta name (conj (or (meta name) {}) metadata))

fn (with-meta `(fn ~id ~@body) (meta &form))]
`(def ~id ~fn)))
(if doc
(let [FN (gensym)]
`(def ~id (let [~FN ~fn] (set! ~(str FN ".wispDocument") ~doc) ~FN)))
`(def ~id ~fn))))
(install-macro! :defn (with-meta expand-defn {:implicit [:&form]}))


Expand Down