JanetDocsPlaygroundI'm feeling luckyGitHub sign in

macex



    function
    boot.janet on line 2120, column 1

    (macex x &opt on-binding)

    Expand macros completely. `on-binding` is an optional callback for 
    whenever a normal symbolic binding is encountered. This allows 
    macros to easily see all bindings used by their arguments by 
    calling `macex` on their contents. The binding itself is also 
    replaced by the value returned by `on-binding` within the expanded 
    macro.


1 exampleSign in to add an example
Loading...
(defmacro inner [x] ~(do [,x (* ,x ,x)]))
(defmacro outer [n] (map |~(inner ,$0) (range n)))

# Hints:
#
# * Quote the argument.
# * Because it's quoted, the argument can have undefined symbols.
# * Compare the result of `macex` with `macex1`.
# * If needed, print the result with `pp`.
#
(macex '(outer 10))
4kbytePlayground