mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2025-04-27 15:43:58 +00:00
Update clojure-macros.html.markdown (#2694)
This commit is contained in:
parent
82c3ce4e8c
commit
5ab4fb659a
@ -99,13 +99,13 @@ You'll want to be familiar with Clojure. Make sure you understand everything in
|
|||||||
(list x) ; -> (4)
|
(list x) ; -> (4)
|
||||||
|
|
||||||
;; You can use # within ` to produce a gensym for each symbol automatically
|
;; You can use # within ` to produce a gensym for each symbol automatically
|
||||||
(defmacro define-x-hygenically []
|
(defmacro define-x-hygienically []
|
||||||
`(do
|
`(do
|
||||||
(def x# 2)
|
(def x# 2)
|
||||||
(list x#)))
|
(list x#)))
|
||||||
|
|
||||||
(def x 4)
|
(def x 4)
|
||||||
(define-x-hygenically) ; -> (2)
|
(define-x-hygienically) ; -> (2)
|
||||||
(list x) ; -> (4)
|
(list x) ; -> (4)
|
||||||
|
|
||||||
;; It's typical to use helper functions with macros. Let's create a few to
|
;; It's typical to use helper functions with macros. Let's create a few to
|
||||||
|
Loading…
Reference in New Issue
Block a user