JanetDocsPlaygroundI'm feeling luckyGitHub sign in

defmacro-



    macro
    boot.janet on line 58, column 1

    (defmacro- name & more)

    Define a private macro that will not be exported.


1 exampleSign in to add an example
Loading...
(defmacro- =dude
 "sets any symbolic expression to the atom :what?"
 [a]
 ~(var a :what?)) # => <function =dude>

(=dude 2) # => :what?

(=dude :2) # => :what?

(=dude 2) # => :what?

(=dude "2") # => :what?

(=dude @"2") # => :what?

(=dude @[2]) # => :what?

(=dude (2)) # => :what?

(=dude @(2)) # => :what?

(=dude @{2 3}) # => :what?


(doc =dude)


# =>    macro
# =>    repl on line 59, column 1
# =>
# =>    (=dude a)


# => nil


# Macro expanding the =dude macro:

(macex (=dude 2)) # => :what?

(macex1 (=dude 2)) # => :what?

# Macros have to be quoted in order to expand

(macex ~(=dude 2)) # => (var a :what?)

(macex1 ~(=dude 2)) # => (var a :what?)

(macex ~(=dude @{2 3})) # => (var a :what?)
jgartePlayground