• Top
    • Documentation
    • Books
    • Recursion-and-induction
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
      • Theories
      • Rule-classes
      • Proof-builder
      • Hons-and-memoization
      • Events
      • History
      • Parallelism
      • Programming
      • Start-here
      • Real
      • Debugging
      • Miscellaneous
      • Output-controls
      • Macros
        • Make-event
        • Defmacro
        • Untranslate-patterns
        • Tc
        • Macro-aliases-table
        • Macro-args
        • Defabbrev
        • User-defined-functions-table
        • Untranslate-for-execution
        • Trans
        • Add-macro-fn
        • Check-vars-not-free
        • Safe-mode
        • Macro-libraries
        • Defmacro-untouchable
        • Trans1
        • Set-duplicate-keys-action
        • Add-macro-alias
        • Magic-macroexpand
        • Defmacroq
          • Remove-macro-fn
          • Remove-macro-alias
          • Add-binop
          • Untrans-table
          • Trans!
          • Remove-binop
          • Tcp
          • Tca
        • Interfacing-tools
      • Interfacing-tools
      • Hardware-verification
      • Software-verification
      • Testing-utilities
      • Math
    • Macros
    • Defmacro
    • Kestrel-utilities

    Defmacroq

    Define a macro that quotes arguments not wrapped in :eval

    Defmacroq has the same general form as defmacro (see defmacro), that is:

    (defmacro name macro-args doc-string dcl ... dcl body)

    However, for any subsequent call of name, and for each variable var introduced by macro-args that is bound to a corresponding value val from the call, var is instead bound to (quote val) with one exception: if val is of the form (:eval x), then var is bound to the expression x. The following example shows how this works.

    ACL2 !>(defmacroq mac2 (x y)
             `(list ,x ,y))
    
    Summary
    Form:  ( DEFMACRO MAC2 ...)
    Rules: NIL
    Time:  0.00 seconds (prove: 0.00, print: 0.00, other: 0.00)
     MAC2
    ACL2 !>:trans1 (mac2 (a b) (:eval (append '(c d) '(e f))))
     (LIST '(A B) (APPEND '(C D) '(E F)))
    ACL2 !>(mac2 (a b) (:eval (append '(c d) '(e f))))
    ((A B) (C D E F))
    ACL2 !>

    Thus, if we ignore the role of :eval, the macro definition above is equivalent to the following.

    (defmacro mac2 (x y)
      `(list ',x ',y))