• 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
      • Parallelism
      • History
      • Programming
        • Defun
        • Declare
        • System-utilities
        • Stobj
        • State
        • Mutual-recursion
        • Memoize
        • Mbe
        • Io
        • Defpkg
        • Apply$
        • Loop$
        • Programming-with-state
        • Arrays
        • Characters
        • Time$
        • Defmacro
          • Prohibition-of-loop$-and-lambda$
          • Ignored-attachment
          • Defmac
          • Defmacro-untouchable
          • Defmacro+
          • Defmacroq
          • Loop$-primer
          • Fast-alists
          • Defconst
          • Evaluation
          • Guard
          • Equality-variants
          • Compilation
          • Hons
          • ACL2-built-ins
          • Developers-guide
          • System-attachments
          • Advanced-features
          • Set-check-invariant-risk
          • Numbers
          • Efficiency
          • Irrelevant-formals
          • Introduction-to-programming-in-ACL2-for-those-who-know-lisp
          • Redefining-programs
          • Lists
          • Invariant-risk
          • Errors
          • Defabbrev
          • Conses
          • Alists
          • Set-register-invariant-risk
          • Strings
          • Program-wrapper
          • Get-internal-time
          • Basics
          • Packages
          • Oracle-eval
          • Defmacro-untouchable
          • <<
          • Primitive
          • Revert-world
          • Unmemoize
          • Set-duplicate-keys-action
          • Symbols
          • Def-list-constructor
          • Easy-simplify-term
          • Defiteration
          • Fake-oracle-eval
          • Defopen
          • Sleep
        • 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))