• 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
        • 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
            • ACL2s-faq
            • Match
            • ACL2s-intro
            • ACL2s-defaults
            • Definec
            • ACL2s-utilities
              • Make-n-ary-macro
                • 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-installation
            • Talks
            • Nqthm-to-ACL2
            • Emacs
          • About-ACL2
        • Real
        • Debugging
        • Miscellaneous
        • Output-controls
        • Macros
        • Interfacing-tools
      • Interfacing-tools
      • Hardware-verification
      • Software-verification
      • Testing-utilities
      • Math
    • 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.