• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
      • Theories
      • Rule-classes
      • Proof-builder
      • Recursion-and-induction
      • Hons-and-memoization
      • Events
        • Defun
        • Verify-guards
        • Table
        • Mutual-recursion
        • Memoize
        • Make-event
        • Include-book
        • Encapsulate
        • Defun-sk
        • Defttag
        • Defstobj
        • Defpkg
        • Defattach
        • Defabsstobj
        • Defchoose
        • Progn
        • Verify-termination
        • Redundant-events
        • Defmacro
          • Prohibition-of-loop$-and-lambda$
          • Ignored-attachment
          • Defmac
          • Defmacro-untouchable
          • Defmacro+
          • Defmacroq
          • Defconst
          • Skip-proofs
          • In-theory
          • Embedded-event-form
          • Value-triple
          • Comp
          • Local
          • Defthm
          • Progn!
          • Defevaluator
          • Theory-invariant
          • Assert-event
          • Defun-inline
          • Project-dir-alist
          • Partial-encapsulate
          • Define-trusted-clause-processor
          • Defproxy
          • Defexec
          • Defun-nx
          • Defthmg
          • Defpun
          • Defabbrev
          • Set-table-guard
          • Name
          • Defrec
          • Add-custom-keyword-hint
          • Regenerate-tau-database
          • Defcong
          • Deftheory
          • Defaxiom
          • Deftheory-static
          • Defund
          • Evisc-table
          • Verify-guards+
          • Logical-name
          • Profile
          • Defequiv
          • Defmacro-untouchable
          • Add-global-stobj
          • Defthmr
          • Defstub
          • Defrefinement
          • Deflabel
          • In-arithmetic-theory
          • Unmemoize
          • Defabsstobj-missing-events
          • Defthmd
          • Fake-event
          • Set-body
          • Defun-notinline
          • Functions-after
          • Macros-after
          • Dump-events
          • Defund-nx
          • Defun$
          • Remove-global-stobj
          • Remove-custom-keyword-hint
          • Dft
          • Defthy
          • Defund-notinline
          • Defnd
          • Defn
          • Defund-inline
          • Defmacro-last
        • Parallelism
        • History
        • Programming
        • Operational-semantics
        • Real
        • Start-here
        • Debugging
        • Miscellaneous
        • Output-controls
        • Macros
        • Interfacing-tools
      • Interfacing-tools
      • Hardware-verification
      • Software-verification
      • Math
      • Testing-utilities
    • 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))