• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Community
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
      • Theories
      • Rule-classes
      • Proof-builder
      • Recursion-and-induction
      • Hons-and-memoization
      • Events
      • Parallelism
      • History
      • Programming
      • Operational-semantics
      • Real
      • Start-here
        • Gentle-introduction-to-ACL2-programming
        • ACL2-tutorial
          • Introduction-to-the-theorem-prover
          • Pages Written Especially for the Tours
          • The-method
          • Advanced-features
          • Interesting-applications
          • Tips
          • Alternative-introduction
          • Tidbits
          • Annotated-ACL2-scripts
          • Startup
          • ACL2-as-standalone-program
          • ACL2-sedan
            • Defunc
            • Cgen
            • Ccg
            • Defdata
            • ACL2s-user-guide
            • ACL2s-tutorial
            • ACL2s-implementation-notes
            • Match
            • ACL2s-faq
            • ACL2s-intro
            • ACL2s-defaults
            • Definec
            • ACL2s-utilities
              • Make-n-ary-macro
                • Remove-dups
                • ACL2-pc::instantiate
                • N<
                • Test-then-skip-proofs
                • ACL2-pc::claim-simple
                • ACL2-pc::pro-or-skip
                • ACL2-pc::retain-or-skip
                • ACL2-pc::repeat-until-done
                • ACL2-pc::drop-or-skip
                • ACL2-pc::cg-or-skip
                • ACL2-pc::by
                • ACL2-pc::split-in-theory
                • Thm-no-test
                • Defthmd-no-test
                • Defthm-no-test
              • ACL2s-interface
              • ACL2s-installation
            • Talks
            • Nqthm-to-ACL2
            • Tours
            • Emacs
          • About-ACL2
            • Recursion-and-induction
            • Operational-semantics
            • Soundness
            • Release-notes
            • Workshops
            • ACL2-tutorial
              • Introduction-to-the-theorem-prover
              • Pages Written Especially for the Tours
              • The-method
              • Advanced-features
              • Interesting-applications
              • Tips
              • Alternative-introduction
              • Tidbits
              • Annotated-ACL2-scripts
              • Startup
              • ACL2-as-standalone-program
              • ACL2-sedan
                • Defunc
                • Cgen
                • Ccg
                • Defdata
                • ACL2s-user-guide
                • ACL2s-tutorial
                • ACL2s-implementation-notes
                • Match
                • ACL2s-faq
                • ACL2s-intro
                • ACL2s-defaults
                • Definec
                • ACL2s-utilities
                  • Make-n-ary-macro
                    • Remove-dups
                    • ACL2-pc::instantiate
                    • N<
                    • Test-then-skip-proofs
                    • ACL2-pc::claim-simple
                    • ACL2-pc::pro-or-skip
                    • ACL2-pc::retain-or-skip
                    • ACL2-pc::repeat-until-done
                    • ACL2-pc::drop-or-skip
                    • ACL2-pc::cg-or-skip
                    • ACL2-pc::by
                    • ACL2-pc::split-in-theory
                    • Thm-no-test
                    • Defthmd-no-test
                    • Defthm-no-test
                  • ACL2s-interface
                  • ACL2s-installation
                • Talks
                • Nqthm-to-ACL2
                • Tours
                • Emacs
              • Version
              • How-to-contribute
              • Acknowledgments
              • Using-ACL2
              • Releases
              • Pre-built-binary-distributions
              • Common-lisp
              • Installation
              • Mailing-lists
              • Git-quick-start
              • Copyright
              • ACL2-help
          • Miscellaneous
          • Output-controls
          • Bdd
          • Macros
          • Installation
          • Mailing-lists
        • Interfacing-tools
        • Hardware-verification
        • Software-verification
        • Math
        • Testing-utilities
      • ACL2s-utilities

      Make-n-ary-macro

      A macro that creates an arbitrary-arity macro given a binary function and associates the function name with the macro name using add-macro-fn.

      Examples:
      (make-n-ary-macro set-union binary-set-union nil t)
      
      (make-n-ary-macro ^ expt 1)
      
      General Form:
      (make-n-ary-macro new-macro-name binary-fun-name identity right-associate-p)

      where new-macro-name is the name of the macro to define, binary-fun-name is the name of an existing binary function and identity is what the macro should return with no arguments. right-associate-p is an optional argument, which when set to t flattens right-associated arguments (see add-macro-fn).

      Given one argument, the macro will just return that argument. Given more than one argument, the macro will expand to a right-associated call of the function. For example:

      (set-union) expands to nil
      
      (set-union arg1) expands to arg1
      
      (set-union arg1 arg2) expands to (binary-set-union arg1 arg2)
      
      (set-union arg1 arg2 arg3) expands to
      (binary-set-union arg1 (binary-set-union arg2 arg3))
      
      and so on.